@tangle-network/agent-app 0.60.165 → 0.60.167
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/dist/assistant/index.js +1 -1
- package/dist/{chunk-S5QRYJW5.js → chunk-AC3UE5JG.js} +10 -7
- package/dist/chunk-AC3UE5JG.js.map +1 -0
- package/dist/web-react/agent-profile-editor.d.ts +8 -0
- package/dist/web-react/agent-profile-editor.js +1 -1
- package/dist/web-react/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-S5QRYJW5.js.map +0 -1
package/dist/assistant/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import "../chunk-FBVLEGEG.js";
|
|
|
8
8
|
import "../chunk-CW6F6GDP.js";
|
|
9
9
|
import "../chunk-ILZQAXJH.js";
|
|
10
10
|
import "../chunk-E4AY62T2.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-AC3UE5JG.js";
|
|
12
12
|
import "../chunk-Y6PRDUFJ.js";
|
|
13
13
|
import "../chunk-GEYACSFW.js";
|
|
14
14
|
import {
|
|
@@ -1328,7 +1328,7 @@ function AgentProfileEditor({
|
|
|
1328
1328
|
files: sectionAllowed("files") && allowsResource("files"),
|
|
1329
1329
|
advanced: sectionAllowed("advanced")
|
|
1330
1330
|
};
|
|
1331
|
-
const unsupportedResources = Object.keys(RESOURCE_KIND_LABELS).filter((kind) => configuredResourceCount(value, kind) > 0 && !(kind === "skills" && show.skills || kind === "tools" && show.toolFiles || kind === "files" && show.files || allowsResource(kind) && kind !== "skills" && kind !== "tools" && kind !== "files"));
|
|
1331
|
+
const unsupportedResources = config?.preserveHiddenResources ? [] : Object.keys(RESOURCE_KIND_LABELS).filter((kind) => configuredResourceCount(value, kind) > 0 && !(kind === "skills" && show.skills || kind === "tools" && show.toolFiles || kind === "files" && show.files || allowsResource(kind) && kind !== "skills" && kind !== "tools" && kind !== "files"));
|
|
1332
1332
|
const skills = value.resources?.skills ?? [];
|
|
1333
1333
|
const toolFiles = value.resources?.tools ?? [];
|
|
1334
1334
|
const files = value.resources?.files ?? [];
|
|
@@ -1789,7 +1789,7 @@ function AgentProfileEditor({
|
|
|
1789
1789
|
) })
|
|
1790
1790
|
] }) }),
|
|
1791
1791
|
show.prompts && /* @__PURE__ */ jsxs7(Section, { title: "Instructions", description: "What the agent is told before every conversation.", children: [
|
|
1792
|
-
/* @__PURE__ */ jsx7(
|
|
1792
|
+
config?.prompts?.appendSystemPrompt !== false && /* @__PURE__ */ jsx7(
|
|
1793
1793
|
Field,
|
|
1794
1794
|
{
|
|
1795
1795
|
label: "Additional instructions",
|
|
@@ -1807,13 +1807,13 @@ function AgentProfileEditor({
|
|
|
1807
1807
|
)
|
|
1808
1808
|
}
|
|
1809
1809
|
),
|
|
1810
|
-
/* @__PURE__ */ jsxs7("details", { className: "group/more", open: moreOpen, onToggle: (event) => setMoreOpen(event.currentTarget.open), children: [
|
|
1810
|
+
(config?.prompts?.systemPrompt !== false || config?.prompts?.instructions !== false) && /* @__PURE__ */ jsxs7("details", { className: "group/more", open: moreOpen, onToggle: (event) => setMoreOpen(event.currentTarget.open), children: [
|
|
1811
1811
|
/* @__PURE__ */ jsxs7("summary", { className: "flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-md text-sm font-medium text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", children: [
|
|
1812
1812
|
/* @__PURE__ */ jsx7("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "size-4 transition-transform group-open/more:rotate-90", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx7("path", { d: "m9 6 6 6-6 6" }) }),
|
|
1813
1813
|
"More instructions"
|
|
1814
1814
|
] }),
|
|
1815
1815
|
/* @__PURE__ */ jsxs7("div", { className: "mt-4 space-y-4", children: [
|
|
1816
|
-
/* @__PURE__ */ jsx7(
|
|
1816
|
+
config?.prompts?.systemPrompt !== false && /* @__PURE__ */ jsx7(
|
|
1817
1817
|
Field,
|
|
1818
1818
|
{
|
|
1819
1819
|
label: "Replacement system prompt",
|
|
@@ -1833,8 +1833,11 @@ function AgentProfileEditor({
|
|
|
1833
1833
|
)
|
|
1834
1834
|
}
|
|
1835
1835
|
),
|
|
1836
|
-
value.prompt?.systemPrompt && /* @__PURE__ */
|
|
1837
|
-
|
|
1836
|
+
config?.prompts?.systemPrompt !== false && value.prompt?.systemPrompt && /* @__PURE__ */ jsxs7(StatusLine, { id: `${id}-system-replaces`, tone: "warning", children: [
|
|
1837
|
+
"The built-in prompt is replaced.",
|
|
1838
|
+
config?.prompts?.appendSystemPrompt !== false && " The agent receives this text, then the additional instructions."
|
|
1839
|
+
] }),
|
|
1840
|
+
config?.prompts?.instructions !== false && /* @__PURE__ */ jsxs7("div", { role: "group", "aria-labelledby": `${id}-instructions-label`, className: "space-y-2", children: [
|
|
1838
1841
|
/* @__PURE__ */ jsx7("div", { className: "flex items-center gap-1.5", children: /* @__PURE__ */ jsx7("span", { id: `${id}-instructions-label`, className: formText.label, children: "Project instructions" }) }),
|
|
1839
1842
|
/* @__PURE__ */ jsx7("p", { className: formText.muted, children: "Lower-priority guidance the agent reads like a project file." }),
|
|
1840
1843
|
(value.prompt?.instructions ?? []).map((instruction, index) => /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
|
|
@@ -2210,4 +2213,4 @@ export {
|
|
|
2210
2213
|
AGENT_PROFILE_EDITOR_SECTIONS,
|
|
2211
2214
|
AgentProfileEditor
|
|
2212
2215
|
};
|
|
2213
|
-
//# sourceMappingURL=chunk-
|
|
2216
|
+
//# sourceMappingURL=chunk-AC3UE5JG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/web-react/agent-profile-editor.tsx","../src/web-react/agent-profile-registry-search.tsx","../src/web-react/agent-profile-registry.ts","../src/web-react/agent-profile-form-kit.tsx","../src/web-react/agent-profile-github-source.tsx","../src/web-react/agent-profile-suggest-input.tsx","../src/web-react/agent-profile-mcp-servers.tsx","../src/web-react/agent-profile-files.tsx"],"sourcesContent":["import { useEffect, useId, useMemo, useState, type ReactNode } from 'react'\nimport type { AgentProfile, AgentProfileFileMount, AgentProfileResourceRef } from '@tangle-network/agent-interface/profile'\nimport { REASONING_EFFORTS } from '@tangle-network/agent-interface/profile'\nimport { reasoningEffortsFor } from '@tangle-network/agent-interface/harness-capabilities'\nimport { agentProfileSchema } from '@tangle-network/agent-interface/profile-schema'\nimport { Button, Input, Textarea, Switch, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@tangle-network/sandbox-ui/primitives'\nimport { TooltipProvider } from '@tangle-network/ui/primitives'\nimport { isModelCompatibleWithHarness, snapModelToHarness, type Harness } from '../harness'\nimport type { CatalogModel } from '../runtime/model-catalog'\nimport { publicHttpsUrlProblem, readSkillFrontmatter, type GitHubSourceCheck, type ProfileEditorGitHubPort, type ProfileEditorMcpPort } from '../profile-editor'\nimport { EffortPicker, effortLevelsFromIds, ModelPicker, type EffortLevel } from './controls'\nimport { HarnessPicker } from './agent-session-controls'\nimport type { AgentProfileRegistryPort } from './agent-profile-registry'\nimport { AgentProfileRegistrySkillSearch } from './agent-profile-registry-search'\nimport { Field, fieldMessageId, formRow, formText, listRow, noAutofill, Notice, rowActions as rowActionsClass, Section, StatusLine } from './agent-profile-form-kit'\nimport { GitHubSourcePicker } from './agent-profile-github-source'\nimport { McpServersEditor } from './agent-profile-mcp-servers'\nimport { ResourceFileDrop, type ResourceFileLimits } from './agent-profile-files'\n\nexport type AgentProfileResourceKind = 'files' | 'skills' | 'tools' | 'agents' | 'commands' | 'instructions'\n\n/** Editor sections a product can offer, in display order. */\nexport type AgentProfileEditorSection = 'identity' | 'prompts' | 'model' | 'tools' | 'skills' | 'toolFiles' | 'mcp' | 'files' | 'advanced'\n\nexport const AGENT_PROFILE_EDITOR_SECTIONS: readonly AgentProfileEditorSection[] =\n ['identity', 'prompts', 'model', 'tools', 'skills', 'toolFiles', 'mcp', 'files', 'advanced']\n\nexport interface AgentProfileEditorSaveState {\n /** Internal JSON, resource, or tool edits have not been applied to the profile. */\n pending: boolean\n /** Validation failed or stored values violate this editor's constraints. */\n invalid: boolean\n}\n\n/** The model catalog the selectors offer: the same list the product's chat composer uses. */\nexport interface AgentProfileEditorModelCatalog {\n models: CatalogModel[]\n loading?: boolean\n error?: string | null\n onRetry?: () => void\n /** Label for an empty model setting, for example \"Product default\". */\n defaultLabel?: string\n}\n\n/**\n * What a product offers in the editor. Every part is optional; an omitted part\n * falls back to the plain control or hides the section.\n */\nexport interface AgentProfileEditorConfig {\n /** Sections to show, in the editor's fixed order. Defaults to every section the other props allow. */\n sections?: readonly AgentProfileEditorSection[]\n identity?: {\n /** False when the product fixes the profile name. Defaults to true. */\n nameEditable?: boolean\n }\n /** Hide prompt controls that the host does not persist or execute. Omitted controls remain enabled. */\n prompts?: {\n appendSystemPrompt?: boolean\n systemPrompt?: boolean\n instructions?: boolean\n }\n /** Keep hidden resources opaque when the host preserves and validates their authority on save. Defaults to false. */\n preserveHiddenResources?: boolean\n /** Catalog-backed model selectors. Without it, model fields are plain text inputs. */\n models?: AgentProfileEditorModelCatalog\n /** Harnesses the product runs. Omit to hide the harness selector. */\n harnesses?: readonly Harness[]\n /** Thinking levels for a harness and model. Defaults to the levels that harness applies, plus Auto. */\n thinkingLevels?: (input: { harness?: Harness; model?: CatalogModel }) => readonly EffortLevel[]\n /** GitHub sources through the product's checks. Without it, GitHub sources are typed by hand. */\n github?: {\n port: ProfileEditorGitHubPort\n /**\n * `reference` stores `{ kind: 'github', repository, path, ref }` pinned to the\n * checked commit. `inline` stores the checked file's text, for products that\n * do not fetch GitHub at run time.\n */\n storage: 'reference' | 'inline'\n /** Where the person connects GitHub, shown when the workspace has no connection. */\n connectHref?: string\n }\n mcp?: {\n /** Health checks; each enabled remote server is checked automatically. */\n port?: ProfileEditorMcpPort\n /** Explain why servers are read-only here. Presence locks toggles and edits. */\n lockReason?: string\n /** Offer local command servers. Defaults to true unless `publicHttpsMcpOnly` is set. */\n allowLocalCommand?: boolean\n }\n /** Limits for uploaded resource files. */\n files?: ResourceFileLimits\n}\n\nexport interface AgentProfileEditorProps {\n value: AgentProfile\n onChange: (value: AgentProfile) => void\n /** Disable the host's save action while edits are pending or invalid. */\n onSaveStateChange?: (state: AgentProfileEditorSaveState) => void\n disabled?: boolean\n className?: string\n /** Product configuration: sections, model catalog, harnesses, and source checks. */\n config?: AgentProfileEditorConfig\n /** Hide unsupported resource controls. Existing entries remain in the profile and are flagged for review. */\n allowedResourceKinds?: readonly AgentProfileResourceKind[]\n /** Require resource file workspace paths under this relative folder, for example `reference/`. */\n filePathPrefix?: string\n /** Disable new executable resource files while retaining existing values for review. Defaults to true. */\n allowExecutableFiles?: boolean\n /** Require a 40-character commit SHA for GitHub resource refs. Defaults to false. */\n requireGitHubCommitSha?: boolean\n /** Require unique skill names matching `[a-z0-9][a-z0-9._-]{0,63}`. Defaults to false. */\n requireUniqueSkillNames?: boolean\n /** Hide the generic tool and permission controls without removing stored values. Defaults to true. */\n showToolsAndPermissions?: boolean\n /** Offer only public HTTPS MCP endpoints while retaining existing servers for review. Defaults to false. */\n publicHttpsMcpOnly?: boolean\n /** Host-supplied registry discovery (agent-app#776). Omit to hide catalog search entirely. */\n registry?: AgentProfileRegistryPort\n}\n\nconst RESOURCE_KIND_LABELS: Record<AgentProfileResourceKind, string> = {\n files: 'Resource files', skills: 'Skills', tools: 'Tool files',\n agents: 'Agent files', commands: 'Command files', instructions: 'Resource instructions',\n}\n\nfunction configuredResourceCount(profile: AgentProfile, kind: AgentProfileResourceKind): number {\n const resource = profile.resources?.[kind]\n return Array.isArray(resource) ? resource.length : resource ? 1 : 0\n}\n\nfunction issueMessage(error: { issues: readonly { path: PropertyKey[]; message: string }[] }) {\n const issue = error.issues[0]\n return issue ? (issue.path.map(String).join('.') || 'Profile') + ': ' + issue.message : 'Invalid profile'\n}\n\nfunction validRelativePath(path: string): boolean {\n return path.length <= 240 && !path.startsWith('/') && !path.includes('\\\\') &&\n !/[\\u0000-\\u001f\\u007f]/.test(path) && path.split('/').every(segment => segment !== '' && segment !== '.' && segment !== '..')\n}\n\nfunction normalizedFilePathPrefix(prefix?: string): string | undefined {\n const folder = prefix?.trim().replace(/\\/+$/, '')\n return folder ? folder + '/' : undefined\n}\n\nconst SKILL_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/\n\n/** Problems with a stored or drafted GitHub reference under the product's constraints. */\nfunction githubRefIssue(ref: AgentProfileResourceRef, requireGitHubCommitSha: boolean): string | null {\n if (ref.kind !== 'github') return null\n const repository = ref.repository ?? ''\n if (!/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/.test(repository) || repository.split('/').some(part => part === '.' || part === '..')) {\n return 'Choose the GitHub repository for this file.'\n }\n if (!ref.path) return 'Choose a file in the repository.'\n if (requireGitHubCommitSha) {\n if (!/^[0-9a-f]{40}$/i.test(ref.ref ?? '')) return 'Pin this source to a 40-character GitHub commit SHA.'\n if (!validRelativePath(ref.path) || /[?#%]/.test(ref.path)) return 'Use a relative repository path without traversal or URL characters.'\n }\n return null\n}\n\nfunction inlineSkillSummary(content: string): string | null {\n const frontmatter = readSkillFrontmatter(content)\n if (frontmatter.ok) return frontmatter.description\n const line = content.split('\\n').map(text => text.replace(/^#+\\s*/, '').trim()).find(Boolean)\n return line ? line.slice(0, 160) : null\n}\n\nfunction sourceLine(ref: AgentProfileResourceRef): string {\n if (ref.kind === 'inline') return `Written here · ${Math.max(1, Math.round(new TextEncoder().encode(ref.content).byteLength / 1024))} KB`\n return ['GitHub', ref.repository ? `${ref.repository}/${ref.path}` : ref.path, ref.ref ? `@ ${ref.ref.slice(0, 7)}` : null].filter(Boolean).join(' · ')\n}\n\nfunction basename(path: string): string {\n return path.split('/').filter(Boolean).pop() ?? path\n}\n\n/** A suggested skill name from frontmatter or the skill folder. */\nfunction suggestedSkillName(check: GitHubSourceCheck): string {\n const fromFrontmatter = check.skill?.name ?? ''\n const folder = check.path.split('/').slice(-2, -1)[0] ?? ''\n const raw = fromFrontmatter || folder || basename(check.path).replace(/\\.md$/i, '')\n return raw.toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[^a-z0-9]+/, '').slice(0, 64)\n}\n\nfunction defaultThinkingLevels({ harness, model }: { harness?: Harness; model?: CatalogModel }): readonly EffortLevel[] {\n const efforts = harness ? reasoningEffortsFor(harness, { supportsReasoning: model?.supportsReasoning !== false }) : REASONING_EFFORTS\n return [{ id: 'auto', label: 'Auto' }, ...effortLevelsFromIds(efforts)]\n}\n\ntype Panel =\n | { kind: 'add-github' | 'add-inline'; section: 'skills' | 'tools' | 'files' }\n | { kind: 'edit'; section: 'skills' | 'tools' | 'files'; index: number }\n\ninterface InlineDraft { name: string; content: string; path: string; executable: boolean }\n\n/** Controlled editor for the canonical profile. The product owns save and execution authority. */\nexport function AgentProfileEditor({ value, onChange, disabled = false, className, config, allowedResourceKinds,\n filePathPrefix, allowExecutableFiles = true, requireGitHubCommitSha = false, requireUniqueSkillNames = false,\n showToolsAndPermissions = true, publicHttpsMcpOnly = false, registry, onSaveStateChange }: AgentProfileEditorProps) {\n const id = useId()\n const workspaceFilePrefix = normalizedFilePathPrefix(filePathPrefix)\n const [error, setError] = useState<string | null>(null)\n const [newTool, setNewTool] = useState('')\n const [showAllTools, setShowAllTools] = useState(false)\n const [panel, setPanel] = useState<Panel | null>(null)\n const [inlineDraft, setInlineDraft] = useState<InlineDraft>({ name: '', content: '', path: '', executable: false })\n const [githubName, setGithubName] = useState<{ value: string; touched: boolean }>({ value: '', touched: false })\n const [mcpPending, setMcpPending] = useState(false)\n const [modelNotice, setModelNotice] = useState<string | null>(null)\n const [json, setJson] = useState(() => JSON.stringify(value, null, 2))\n const [jsonDirty, setJsonDirty] = useState(false)\n useEffect(() => { if (!jsonDirty) setJson(JSON.stringify(value, null, 2)) }, [value, jsonDirty])\n const editingDisabled = disabled || jsonDirty\n // More instructions holds the replacement prompt and project instructions; it is open whenever\n // either has content, including content that arrives after the first render.\n const hasMorePrompt = Boolean(value.prompt?.systemPrompt || value.prompt?.instructions?.length)\n const [moreOpen, setMoreOpen] = useState(hasMorePrompt)\n useEffect(() => { if (hasMorePrompt) setMoreOpen(true) }, [hasMorePrompt])\n\n const sectionAllowed = (section: AgentProfileEditorSection) => !config?.sections || config.sections.includes(section)\n const allowsResource = (kind: AgentProfileResourceKind) => !allowedResourceKinds || allowedResourceKinds.includes(kind)\n const show = {\n identity: sectionAllowed('identity'),\n prompts: sectionAllowed('prompts'),\n model: sectionAllowed('model'),\n tools: sectionAllowed('tools') && showToolsAndPermissions,\n skills: sectionAllowed('skills') && allowsResource('skills'),\n toolFiles: sectionAllowed('toolFiles') && allowsResource('tools'),\n mcp: sectionAllowed('mcp'),\n files: sectionAllowed('files') && allowsResource('files'),\n advanced: sectionAllowed('advanced'),\n }\n const unsupportedResources = config?.preserveHiddenResources ? [] :\n (Object.keys(RESOURCE_KIND_LABELS) as AgentProfileResourceKind[])\n .filter(kind => configuredResourceCount(value, kind) > 0 && !(\n (kind === 'skills' && show.skills) || (kind === 'tools' && show.toolFiles) || (kind === 'files' && show.files) ||\n (allowsResource(kind) && kind !== 'skills' && kind !== 'tools' && kind !== 'files')))\n const skills = value.resources?.skills ?? []\n const toolFiles = value.resources?.tools ?? []\n const files = value.resources?.files ?? []\n const instructions = value.resources?.instructions\n\n function skillIssue(ref: AgentProfileResourceRef, refs: readonly AgentProfileResourceRef[], index?: number): string | null {\n if (requireUniqueSkillNames) {\n const name = ref.name ?? ''\n if (!SKILL_NAME.test(name)) return 'Use a lowercase name of up to 64 letters, numbers, dots, dashes, or underscores.'\n if (refs.some((other, item) => item !== index && other.name === name)) return 'Another skill already uses this name.'\n }\n if (ref.kind === 'inline' && !ref.name.trim()) return 'Name this skill.'\n return githubRefIssue(ref, requireGitHubCommitSha)\n }\n function fileIssue(mount: AgentProfileFileMount, index?: number): string | null {\n const path = mount.path\n if (!path.trim()) return 'Enter a workspace path for the file.'\n if (!validRelativePath(path)) return 'Use a relative workspace path without traversal.'\n if (workspaceFilePrefix && !path.startsWith(workspaceFilePrefix)) return `Place this file under ${workspaceFilePrefix}.`\n if (files.some((other, item) => item !== index && other.path === path)) return 'Another file already uses this path.'\n if (!allowExecutableFiles && mount.executable) return 'Executable files are not allowed in this product.'\n if (mount.resource.kind === 'inline' && !mount.resource.name.trim()) return 'Name this file.'\n return githubRefIssue(mount.resource, requireGitHubCommitSha)\n }\n const constrainedEntryCount = workspaceFilePrefix || !allowExecutableFiles || requireGitHubCommitSha || requireUniqueSkillNames\n ? files.filter((mount, index) => fileIssue(mount, index)).length +\n skills.filter((ref, index) => skillIssue(ref, skills, index)).length +\n toolFiles.filter(ref => requireGitHubCommitSha && githubRefIssue(ref, true)).length +\n Number(Boolean(requireGitHubCommitSha && instructions && typeof instructions === 'object' && githubRefIssue(instructions, true)))\n : 0\n const invalidMcpCount = publicHttpsMcpOnly\n ? Object.values(value.mcp ?? {}).filter(server => server.enabled !== false &&\n (!('url' in server) || !server.url || publicHttpsUrlProblem(server.url) !== null)).length : 0\n\n const pending = jsonDirty || panel !== null || mcpPending || Boolean(newTool.trim())\n const invalid = Boolean(error || unsupportedResources.length || constrainedEntryCount || invalidMcpCount)\n useEffect(() => { onSaveStateChange?.({ pending, invalid }) }, [onSaveStateChange, pending, invalid])\n useEffect(() => () => { onSaveStateChange?.({ pending: false, invalid: false }) }, [onSaveStateChange])\n\n function emit(next: AgentProfile) {\n if (jsonDirty) { setError('Apply or discard JSON edits first.'); return false }\n const result = agentProfileSchema.safeParse(next)\n if (!result.success) { setError(issueMessage(result.error)); return false }\n setError(null)\n onChange(result.data)\n return true\n }\n // An emptied prompt box removes its key: an empty replacement or appended prompt is not a prompt,\n // and runtimes refuse it rather than guess whether it means \"none\" or \"keep the built-in prompt\".\n function prompt(next: NonNullable<AgentProfile['prompt']>) {\n const cleaned = { ...next }\n if (cleaned.systemPrompt === '') delete cleaned.systemPrompt\n if (cleaned.appendSystemPrompt === '') delete cleaned.appendSystemPrompt\n const { prompt: _prompt, ...rest } = value\n emit(Object.values(cleaned).some(item => item !== undefined) ? { ...rest, prompt: cleaned } : rest)\n }\n function model(next: NonNullable<AgentProfile['model']>) {\n const cleaned = Object.fromEntries(Object.entries(next).filter(([, item]) => item !== undefined && item !== '')) as NonNullable<AgentProfile['model']>\n const { model: _model, ...rest } = value\n emit(Object.keys(cleaned).length ? { ...rest, model: cleaned } : rest)\n }\n function resources(key: 'skills' | 'tools', refs: AgentProfileResourceRef[]) {\n return emit({ ...value, resources: { ...value.resources, [key]: refs } })\n }\n function setFiles(next: AgentProfileFileMount[]) {\n return emit({ ...value, resources: { ...value.resources, files: next } })\n }\n function openPanel(next: Panel | null) {\n setPanel(next)\n setError(null)\n setGithubName({ value: '', touched: false })\n if (next?.kind === 'edit') {\n const ref = next.section === 'files' ? files[next.index]?.resource : (next.section === 'skills' ? skills : toolFiles)[next.index]\n const mount = next.section === 'files' ? files[next.index] : undefined\n setInlineDraft({ name: ref?.kind === 'inline' ? ref.name : ref?.name ?? '', content: ref?.kind === 'inline' ? ref.content : '',\n path: mount?.path ?? '', executable: mount?.executable ?? false })\n } else {\n setInlineDraft({ name: '', content: '', path: next?.section === 'files' ? workspaceFilePrefix ?? '' : '', executable: false })\n }\n }\n function applyJson() {\n try {\n const result = agentProfileSchema.safeParse(JSON.parse(json))\n if (!result.success) { setError(issueMessage(result.error)); return }\n setError(null)\n setJsonDirty(false)\n onChange(result.data)\n } catch (cause) { setError(cause instanceof Error ? cause.message : 'Invalid JSON') }\n }\n\n // ── Model and runtime ─────────────────────────────────────────────────────\n const catalog = config?.models\n // The stored harness, even when the product's list omits it, so the selector reports what will run.\n const harness = value.harness as Harness | undefined\n const offeredModels = useMemo(() => !catalog ? [] : harness\n ? catalog.models.filter(item => isModelCompatibleWithHarness(harness, item.id))\n : catalog.models, [catalog, harness])\n const selectedModel = catalog?.models.find(item => item.id === value.model?.default)\n const thinkingLevels = (config?.thinkingLevels ?? defaultThinkingLevels)({ harness, model: selectedModel })\n function changeHarness(next: Harness | '') {\n setModelNotice(null)\n const { harness: _harness, ...rest } = value\n let nextModel = value.model\n if (next && catalog && value.model?.default && !isModelCompatibleWithHarness(next, value.model.default)) {\n const ids = catalog.models.map(item => item.id)\n const snapped = snapModelToHarness(next, value.model.default, ids)\n if (snapped !== value.model.default) {\n nextModel = { ...value.model, default: snapped }\n const name = catalog.models.find(item => item.id === snapped)?.name ?? snapped\n setModelNotice(`Default model changed to ${name}, which runs on this harness.`)\n }\n }\n emit({ ...rest, ...(next ? { harness: next } : {}), ...(nextModel ? { model: nextModel } : {}) })\n }\n function modelField(label: string, field: 'default' | 'small', info: ReactNode) {\n const fieldId = `${id}-model-${field}`\n const current = value.model?.[field] ?? ''\n return <Field label={label} htmlFor={fieldId} info={info}>\n {catalog\n ? <ModelPicker id={fieldId} variant=\"field\" value={current} onChange={next => model({ ...value.model, [field]: next || undefined })}\n models={offeredModels} loading={catalog.loading} error={catalog.error} onRetry={catalog.onRetry} disabled={editingDisabled}\n defaultOption={{ label: catalog.defaultLabel ?? 'Product default' }} />\n : <Input id={fieldId} size=\"compact\" value={current} disabled={editingDisabled} placeholder=\"provider/model\" {...noAutofill}\n onChange={event => model({ ...value.model, [field]: event.target.value || undefined })} />}\n </Field>\n }\n\n // ── Resource rows and panels ─────────────────────────────────────────────\n const github = config?.github\n function refFromCheck(check: GitHubSourceCheck, name: string): AgentProfileResourceRef {\n return github?.storage === 'inline'\n ? { kind: 'inline', name, content: check.content }\n : { kind: 'github', repository: check.repository, path: check.path, ref: check.commit.sha, ...(name ? { name } : {}) }\n }\n function addRef(section: 'skills' | 'tools', ref: AgentProfileResourceRef, index?: number): boolean {\n const refs = section === 'skills' ? skills : toolFiles\n const issue = section === 'skills' ? skillIssue(ref, refs, index ?? refs.length) : githubRefIssue(ref, requireGitHubCommitSha)\n if (issue) { setError(issue); return false }\n const next = index === undefined ? [...refs, ref] : refs.map((item, position) => position === index ? ref : item)\n return resources(section, next)\n }\n function addFile(mount: AgentProfileFileMount, index?: number): boolean {\n const issue = fileIssue(mount, index ?? files.length)\n if (issue) { setError(issue); return false }\n return setFiles(index === undefined ? [...files, mount] : files.map((item, position) => position === index ? mount : item))\n }\n\n function nameField(check: GitHubSourceCheck | null, section: 'skills' | 'tools') {\n const fieldId = `${id}-${section}-github-name`\n const suggested = check ? (section === 'skills' ? suggestedSkillName(check) : basename(check.path)) : ''\n const name = githubName.touched ? githubName.value : suggested\n const problem = section === 'skills' && requireUniqueSkillNames && name\n ? skillIssue({ kind: 'inline', name, content: '' }, skills) : null\n return <Field label={section === 'skills' ? 'Skill name' : 'File name'} htmlFor={fieldId} error={problem}\n hint={section === 'skills' && !problem ? 'Shown to the agent in its skill list.' : undefined}>\n <Input id={fieldId} size=\"compact\" value={name} disabled={editingDisabled || !check} {...noAutofill}\n aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(fieldId)}\n onChange={event => setGithubName({ value: event.target.value, touched: true })} />\n </Field>\n }\n function githubNameValue(check: GitHubSourceCheck, section: 'skills' | 'tools'): string {\n return (githubName.touched ? githubName.value : section === 'skills' ? suggestedSkillName(check) : basename(check.path)).trim()\n }\n\n function inlineEditor(section: 'skills' | 'tools' | 'files', index?: number) {\n const prefix = `${id}-${section}-inline`\n const isSkill = section === 'skills'\n const isFile = section === 'files'\n const name = inlineDraft.name.trim()\n const frontmatter = isSkill && inlineDraft.content.trim() ? readSkillFrontmatter(inlineDraft.content) : null\n const mount: AgentProfileFileMount | null = isFile ? { path: inlineDraft.path.trim(),\n resource: { kind: 'inline', name: name || basename(inlineDraft.path.trim()), content: inlineDraft.content },\n ...(inlineDraft.executable ? { executable: true } : {}) } : null\n const problem = isFile ? (inlineDraft.path.trim() ? fileIssue(mount!, index ?? files.length) : null)\n : isSkill && name ? skillIssue({ kind: 'inline', name, content: inlineDraft.content }, skills, index ?? skills.length) : null\n const ready = !editingDisabled && !problem && (isFile ? inlineDraft.path.trim() !== '' : name !== '')\n return <div className=\"space-y-4 rounded-lg border border-border bg-muted/30 p-4\">\n {isFile\n ? <Field label=\"Workspace path\" htmlFor={`${prefix}-path`} error={problem}\n hint={!problem && workspaceFilePrefix ? `Files go under ${workspaceFilePrefix}` : undefined}>\n <Input id={`${prefix}-path`} size=\"compact\" value={inlineDraft.path} disabled={editingDisabled} {...noAutofill}\n placeholder={(workspaceFilePrefix ?? '') + 'guide.md'} aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(`${prefix}-path`)}\n onChange={event => setInlineDraft({ ...inlineDraft, path: event.target.value })} />\n </Field>\n : <Field label={isSkill ? 'Skill name' : 'File name'} htmlFor={`${prefix}-name`} error={problem}>\n <Input id={`${prefix}-name`} size=\"compact\" value={inlineDraft.name} disabled={editingDisabled} {...noAutofill}\n placeholder={isSkill ? 'research' : 'search.ts'} aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(`${prefix}-name`)}\n onChange={event => setInlineDraft({ ...inlineDraft, name: event.target.value })} />\n </Field>}\n <Field label=\"Content\" htmlFor={`${prefix}-content`}\n hint={frontmatter && !frontmatter.ok ? 'Start the skill with frontmatter that sets name and description, so the agent knows when to use it.' : undefined}>\n <Textarea id={`${prefix}-content`} className=\"min-h-40 font-mono text-sm leading-6\" disabled={editingDisabled} value={inlineDraft.content}\n onChange={event => setInlineDraft({ ...inlineDraft, content: event.target.value })} />\n </Field>\n {isFile && (allowExecutableFiles || inlineDraft.executable) && <label className={`flex items-center gap-3 ${formText.body}`}>\n <Switch disabled={editingDisabled || (!allowExecutableFiles && !inlineDraft.executable)} checked={inlineDraft.executable}\n onCheckedChange={executable => setInlineDraft({ ...inlineDraft, executable })} />Executable</label>}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" size=\"compact\" disabled={!ready} onClick={() => {\n const saved = isFile ? addFile(mount!, index)\n : addRef(section as 'skills' | 'tools', { kind: 'inline', name, content: inlineDraft.content }, index)\n if (saved) openPanel(null)\n }}>{index === undefined ? (isSkill ? 'Add skill' : 'Add file') : 'Save'}</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={() => openPanel(null)}>Cancel</Button>\n </div>\n </div>\n }\n\n function githubEditor(section: 'skills' | 'tools' | 'files', index?: number) {\n if (!github) return null\n const existing = index === undefined ? undefined\n : section === 'files' ? files[index]?.resource : (section === 'skills' ? skills : toolFiles)[index]\n const initial = existing?.kind === 'github' ? { repository: existing.repository, path: existing.path, ref: existing.ref } : undefined\n const isFile = section === 'files'\n const pathId = `${id}-${section}-github-path`\n return <div className=\"rounded-lg border border-border bg-muted/30 p-4\">\n <GitHubSourcePicker port={github.port} purpose={section === 'skills' ? 'skill' : 'file'} disabled={editingDisabled}\n connectHref={github.connectHref} initial={initial} onCancel={() => openPanel(null)}\n actionLabel={index !== undefined ? 'Save' : section === 'skills' ? 'Add skill' : 'Add file'}\n blocked={isFile && inlineDraft.path.trim() === '' ? 'Enter a workspace path.' : null}\n onChoose={({ check }) => {\n if (isFile) {\n const path = (inlineDraft.path.trim() || (workspaceFilePrefix ?? '') + basename(check.path))\n if (addFile({ path, resource: refFromCheck(check, basename(check.path)) }, index)) openPanel(null)\n return\n }\n const name = githubNameValue(check, section as 'skills' | 'tools')\n if (addRef(section as 'skills' | 'tools', refFromCheck(check, name), index)) openPanel(null)\n }}>\n {check => isFile\n ? <GitHubFilePath check={check} id={pathId} value={inlineDraft.path} prefix={workspaceFilePrefix ?? ''} disabled={editingDisabled}\n onChange={path => setInlineDraft(current => ({ ...current, path }))} issue={inlineDraft.path.trim() && check\n ? fileIssue({ path: inlineDraft.path.trim(), resource: refFromCheck(check, basename(check.path)) }, index ?? files.length) : null} />\n : nameField(check, section as 'skills' | 'tools')}\n </GitHubSourcePicker>\n </div>\n }\n\n function rowActions(label: string, section: 'skills' | 'tools' | 'files', index: number, ref: AgentProfileResourceRef) {\n const canEdit = ref.kind === 'inline' || Boolean(github)\n return <div className={rowActionsClass}>\n {canEdit && <Button type=\"button\" size=\"compact\" variant=\"ghost\" disabled={editingDisabled} aria-label={`Edit ${label}`}\n onClick={() => openPanel({ kind: 'edit', section, index })}>Edit</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={editingDisabled}\n aria-label={`Remove ${label}`} onClick={() => {\n const removed = section === 'files' ? setFiles(files.filter((_, item) => item !== index))\n : resources(section, (section === 'skills' ? skills : toolFiles).filter((_, item) => item !== index))\n if (removed && panel?.kind === 'edit' && panel.section === section) openPanel(null)\n }}>Remove</Button>\n </div>\n }\n\n function refList(section: 'skills' | 'tools', refs: readonly AgentProfileResourceRef[], noun: string) {\n if (refs.length === 0) return <p className={formText.muted}>No {noun}s yet.</p>\n return <ul className=\"divide-y divide-border rounded-lg border border-border\">{refs.map((ref, index) => {\n const title = ref.name || (ref.kind === 'github' ? basename(ref.path) : `${noun} ${index + 1}`)\n const issue = section === 'skills' ? skillIssue(ref, refs, index) : githubRefIssue(ref, requireGitHubCommitSha)\n const described = ref.kind === 'inline' && section === 'skills' ? inlineSkillSummary(ref.content) : null\n const words = (text: string) => text.toLowerCase().replace(/[-_\\s]+/g, ' ').trim()\n const summary = described && words(described) !== words(title) ? described : null\n const editing = panel?.kind === 'edit' && panel.section === section && panel.index === index\n return <li key={`${section}-${index}`} className=\"space-y-3 p-3\" aria-label={`${noun} ${title}`}>\n <div className={listRow}>\n <div className=\"min-w-0\">\n <p className={`break-words ${formText.label}`}>{title}</p>\n {summary && <p className={`line-clamp-2 ${formText.muted}`}>{summary}</p>}\n {(ref.kind === 'github' || !summary) && <p className={`break-words ${formText.muted}`}>{sourceLine(ref)}</p>}\n {issue && <p className={formText.error}>{issue}</p>}\n </div>\n {rowActions(title, section, index, ref)}\n </div>\n {editing && (ref.kind === 'github' && github ? githubEditor(section, index) : inlineEditor(section, index))}\n </li>\n })}</ul>\n }\n\n function addButtons(section: 'skills' | 'tools' | 'files', writeLabel: string) {\n if (panel && panel.kind !== 'edit' && panel.section === section) {\n return panel.kind === 'add-github' ? githubEditor(section) : inlineEditor(section)\n }\n return <div className=\"flex flex-wrap gap-2\">\n {github && <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-github', section })}>Add from GitHub</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-inline', section })}>{writeLabel}</Button>\n </div>\n }\n\n const countLabel = (count: number, noun: string) => count ? `${count} ${noun}${count === 1 ? '' : 's'}` : undefined\n const toolNames = Object.keys(value.tools ?? {})\n\n return <TooltipProvider delayDuration={150}>\n <div className={`@container/profile-editor min-w-0 space-y-4 ${className ?? ''}`} aria-label=\"Agent profile editor\">\n {error && <Notice tone=\"error\">{error}</Notice>}\n {jsonDirty && <Notice tone=\"info\">Apply or discard your Advanced JSON edits before changing other fields.</Notice>}\n {unsupportedResources.length > 0 && <Notice tone=\"error\">\n This profile has resources this product does not use: {unsupportedResources.map(kind => `${RESOURCE_KIND_LABELS[kind]} (${configuredResourceCount(value, kind)})`).join(', ')}.\n Remove them in Advanced JSON before saving.\n </Notice>}\n {constrainedEntryCount > 0 && <Notice tone=\"error\">\n {constrainedEntryCount === 1 ? 'One resource needs' : `${constrainedEntryCount} resources need`} a fix before this profile can be saved. The affected rows say what to change.\n </Notice>}\n {invalidMcpCount > 0 && <Notice tone=\"error\">\n {invalidMcpCount === 1 ? 'One MCP server needs' : `${invalidMcpCount} MCP servers need`} a public HTTPS address before this profile can be saved.\n </Notice>}\n\n {show.identity && <Section title=\"Identity\">\n <div className={formRow}>\n {config?.identity?.nameEditable !== false && <Field label=\"Name\" htmlFor={`${id}-name`}>\n <Input id={`${id}-name`} size=\"compact\" disabled={editingDisabled} value={value.name ?? ''} {...noAutofill}\n onChange={event => emit({ ...value, name: event.target.value })} />\n </Field>}\n <Field label=\"Description\" htmlFor={`${id}-description`}>\n <Input id={`${id}-description`} size=\"compact\" disabled={editingDisabled} value={value.description ?? ''} {...noAutofill}\n onChange={event => emit({ ...value, description: event.target.value })} />\n </Field>\n </div>\n </Section>}\n\n {show.prompts && <Section title=\"Instructions\" description=\"What the agent is told before every conversation.\">\n {config?.prompts?.appendSystemPrompt !== false && <Field label=\"Additional instructions\" htmlFor={`${id}-append`}\n info=\"Added after the agent's built-in prompt, which stays in force. Leave it empty to add nothing.\">\n <Textarea id={`${id}-append`} className=\"min-h-40 text-sm leading-6\" disabled={editingDisabled} value={value.prompt?.appendSystemPrompt ?? ''}\n onChange={event => prompt({ ...value.prompt, appendSystemPrompt: event.target.value })} />\n </Field>}\n {(config?.prompts?.systemPrompt !== false || config?.prompts?.instructions !== false) &&\n <details className=\"group/more\" open={moreOpen} onToggle={event => setMoreOpen(event.currentTarget.open)}>\n <summary className=\"flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-md text-sm font-medium text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 transition-transform group-open/more:rotate-90\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m9 6 6 6-6 6\" /></svg>\n More instructions\n </summary>\n <div className=\"mt-4 space-y-4\">\n {config?.prompts?.systemPrompt !== false && <Field label=\"Replacement system prompt\" htmlFor={`${id}-system`}\n info=\"Replaces the agent's built-in prompt entirely. Leave it empty to keep the built-in prompt.\">\n <Textarea id={`${id}-system`} size=\"compact\" className=\"min-h-24 text-sm leading-6\" disabled={editingDisabled} value={value.prompt?.systemPrompt ?? ''}\n aria-describedby={value.prompt?.systemPrompt ? `${id}-system-replaces` : undefined}\n onChange={event => prompt({ ...value.prompt, systemPrompt: event.target.value })} />\n </Field>}\n {config?.prompts?.systemPrompt !== false && value.prompt?.systemPrompt && <StatusLine id={`${id}-system-replaces`} tone=\"warning\">\n The built-in prompt is replaced.{config?.prompts?.appendSystemPrompt !== false && ' The agent receives this text, then the additional instructions.'}</StatusLine>}\n {config?.prompts?.instructions !== false && <div role=\"group\" aria-labelledby={`${id}-instructions-label`} className=\"space-y-2\">\n <div className=\"flex items-center gap-1.5\">\n <span id={`${id}-instructions-label`} className={formText.label}>Project instructions</span>\n </div>\n <p className={formText.muted}>Lower-priority guidance the agent reads like a project file.</p>\n {(value.prompt?.instructions ?? []).map((instruction, index) =>\n <div key={index} className=\"flex items-start gap-2\">\n <Textarea aria-label={`Instruction ${index + 1}`} size=\"compact\" className=\"min-h-20 text-sm leading-6\" disabled={editingDisabled} value={instruction}\n onChange={event => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).map((item, i) => i === index ? event.target.value : item) })} />\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={editingDisabled}\n aria-label={`Remove instruction ${index + 1}`}\n onClick={() => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).filter((_, i) => i !== index) })}>Remove</Button>\n </div>)}\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => prompt({ ...value.prompt, instructions: [...(value.prompt?.instructions ?? []), ''] })}>Add instruction</Button>\n </div>}\n </div>\n </details>}\n </Section>}\n\n {show.model && <Section title=\"Model and runtime\" description=\"Defaults for conversations and automations that do not choose their own.\">\n <div className={formRow}>\n {modelField('Default model', 'default', 'Runs when a conversation or automation does not pick a model.')}\n {config?.harnesses && config.harnesses.length > 0 && <Field label=\"Harness\" htmlFor={`${id}-harness`}\n info=\"The agent runtime that runs this profile, such as OpenCode or Codex.\">\n <HarnessPicker id={`${id}-harness`} variant=\"field\" value={harness ?? ''} onChange={changeHarness}\n available={config.harnesses} defaultOption={{ label: catalog?.defaultLabel ?? 'Product default' }} disabled={editingDisabled} />\n </Field>}\n <Field label=\"Thinking\" htmlFor={`${id}-thinking`} info=\"How hard the agent reasons before answering. Auto lets the harness decide.\">\n <EffortPicker id={`${id}-thinking`} variant=\"field\" label=\"\" value={value.model?.reasoningEffort ?? 'auto'} levels={thinkingLevels}\n disabled={editingDisabled}\n onChange={level => model({ ...value.model, reasoningEffort: level === 'auto' ? undefined : level as NonNullable<AgentProfile['model']>['reasoningEffort'] })} />\n </Field>\n {modelField('Small model', 'small', 'A faster model for short tasks such as titles and summaries.')}\n </div>\n {modelNotice && <StatusLine tone=\"neutral\">{modelNotice}</StatusLine>}\n </Section>}\n\n {show.tools && <Section title=\"Tools and permissions\" description=\"Which tools the agent may use, and when it must ask first.\"\n collapsible summary={countLabel(toolNames.length, 'rule')}>\n {toolNames.length === 0 && <p className={formText.muted}>No tool rules yet.</p>}\n {toolNames.length > 0 && <ul className=\"divide-y divide-border rounded-lg border border-border\">\n {Object.entries(value.tools ?? {}).slice(0, showAllTools ? undefined : 6).map(([name, enabled]) => {\n const switchId = `${id}-tool-${name}`\n return <li key={name} className=\"flex flex-wrap items-center gap-3 p-3\">\n <Switch id={switchId} disabled={editingDisabled} checked={enabled} aria-label={`Allow ${name}`}\n onCheckedChange={checked => emit({ ...value, tools: { ...value.tools, [name]: checked } })} />\n <label htmlFor={switchId} className={`min-w-24 flex-1 break-words ${formText.label}`}>{name}</label>\n <Select disabled={editingDisabled} value={typeof value.permissions?.[name] === 'string' ? value.permissions[name] as string : 'default'}\n onValueChange={permission => { const permissions = { ...value.permissions }; if (permission !== 'default') permissions[name] = permission as 'allow' | 'ask' | 'deny'; else delete permissions[name]; emit({ ...value, permissions }) }}>\n <SelectTrigger size=\"compact\" aria-label={`Permission for ${name}`} className=\"w-36 shadow-none\"><SelectValue /></SelectTrigger>\n <SelectContent>\n <SelectItem value=\"default\">Default</SelectItem><SelectItem value=\"allow\">Allow</SelectItem>\n <SelectItem value=\"ask\">Ask first</SelectItem><SelectItem value=\"deny\">Deny</SelectItem>\n </SelectContent>\n </Select>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={editingDisabled}\n aria-label={`Remove ${name}`} onClick={() => { const tools = { ...value.tools }; delete tools[name]; emit({ ...value, tools }) }}>Remove</Button>\n </li>\n })}\n </ul>}\n {toolNames.length > 6 && <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={() => setShowAllTools(current => !current)}>\n {showAllTools ? 'Show fewer' : `Show ${toolNames.length - 6} more`}\n </Button>}\n <div className=\"flex gap-2\">\n <Input aria-label=\"New tool name\" size=\"compact\" disabled={editingDisabled} value={newTool} placeholder=\"Tool name\" {...noAutofill}\n onChange={event => setNewTool(event.target.value)} />\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled || !newTool.trim()} onClick={() => {\n const name = newTool.trim()\n if (name in (value.tools ?? {})) { setError('A rule for this tool already exists.'); return }\n if (emit({ ...value, tools: { ...value.tools, [name]: true } })) setNewTool('')\n }}>Add tool</Button>\n </div>\n <p className={formText.muted}>Nested permission rules are edited in Advanced JSON.</p>\n </Section>}\n\n {show.skills && <Section title=\"Skills\" description=\"Instructions the agent loads when a task calls for them.\"\n collapsible defaultOpen={skills.length > 0 || panel?.section === 'skills'} summary={countLabel(skills.length, 'skill')}>\n {refList('skills', skills, 'Skill')}\n {addButtons('skills', 'Write a skill')}\n {registry && <AgentProfileRegistrySkillSearch registry={registry} disabled={editingDisabled} existing={skills}\n validate={ref => skillIssue(ref, skills, skills.length)}\n onAdd={ref => resources('skills', [...skills, ref])} />}\n </Section>}\n\n {show.toolFiles && <Section title=\"Tool files\" description=\"Files that define custom tools.\"\n collapsible defaultOpen={toolFiles.length > 0} summary={countLabel(toolFiles.length, 'file')}>\n {refList('tools', toolFiles, 'Tool file')}\n {addButtons('tools', 'Write a tool file')}\n </Section>}\n\n {show.mcp && <Section title=\"MCP servers\" description=\"Tool servers the agent connects to.\"\n collapsible defaultOpen={Object.keys(value.mcp ?? {}).length > 0} summary={countLabel(Object.keys(value.mcp ?? {}).length, 'server')}>\n <McpServersEditor servers={value.mcp ?? {}} disabled={editingDisabled} port={config?.mcp?.port} lockReason={config?.mcp?.lockReason}\n publicHttpsOnly={publicHttpsMcpOnly} allowLocalCommand={config?.mcp?.allowLocalCommand ?? !publicHttpsMcpOnly}\n registry={registry} onPendingChange={setMcpPending}\n onChange={next => { const { mcp: _mcp, ...rest } = value; return emit(Object.keys(next).length ? { ...value, mcp: next } : rest) }} />\n </Section>}\n\n {show.files && <Section title=\"Resource files\" description=\"Reference files placed in the agent's workspace.\"\n collapsible defaultOpen={files.length > 0 || panel?.section === 'files'} summary={countLabel(files.length, 'file')}>\n {files.length === 0 && <p className={formText.muted}>No resource files yet.</p>}\n {files.length > 0 && <ul className=\"divide-y divide-border rounded-lg border border-border\">{files.map((mount, index) => {\n const issue = fileIssue(mount, index)\n const editing = panel?.kind === 'edit' && panel.section === 'files' && panel.index === index\n return <li key={`${mount.path}-${index}`} className=\"space-y-3 p-3\" aria-label={`Resource file ${mount.path}`}>\n <div className={listRow}>\n <div className=\"min-w-0\">\n <p className={`break-words [overflow-wrap:anywhere] ${formText.label}`}>{mount.path}</p>\n <p className={`break-words ${formText.muted}`}>{sourceLine(mount.resource)}{mount.executable ? ' · Executable' : ''}</p>\n {issue && <p className={formText.error}>{issue}</p>}\n </div>\n {rowActions(mount.path, 'files', index, mount.resource)}\n </div>\n {editing && (mount.resource.kind === 'github' && github ? githubEditor('files', index) : inlineEditor('files', index))}\n </li>\n })}</ul>}\n {panel && panel.kind !== 'edit' && panel.section === 'files' && addButtons('files', 'Write a file')}\n <ResourceFileDrop existingPaths={files.map(mount => mount.path)} pathPrefix={workspaceFilePrefix} limits={config?.files}\n disabled={editingDisabled} actions={!(panel && panel.kind !== 'edit' && panel.section === 'files') && <>\n {github && <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-github', section: 'files' })}>Add from GitHub</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-inline', section: 'files' })}>Write a file</Button>\n </>} onAdd={added => {\n const mounts = added.map(({ path, file }) => ({ path, resource: { kind: 'inline' as const, name: file.name, content: file.content } }))\n const next = [...files, ...mounts]\n const issue = mounts.map((mount, offset) => fileIssue(mount, files.length + offset)).find(Boolean)\n if (issue) return issue\n return setFiles(next) ? null : 'The profile did not accept these files.'\n }} />\n </Section>}\n\n {show.advanced && <Section title=\"Advanced JSON\" description=\"The complete profile, including hooks, modes, connections, and extensions.\" collapsible>\n <label htmlFor={`${id}-json`} className=\"sr-only\">Full profile JSON</label>\n <Textarea id={`${id}-json`} className=\"min-h-72 font-mono text-sm leading-6\" spellCheck={false} disabled={disabled} value={json}\n onChange={event => { setJson(event.target.value); setJsonDirty(true) }} />\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={disabled || !jsonDirty} onClick={applyJson}>Apply JSON</Button>\n {jsonDirty && <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={disabled}\n onClick={() => { setJson(JSON.stringify(value, null, 2)); setJsonDirty(false); setError(null) }}>Discard JSON edits</Button>}\n </div>\n <p className={formText.muted}>Reference credentials by secret name; never paste them into a profile.</p>\n </Section>}\n </div>\n </TooltipProvider>\n}\n\nfunction GitHubFilePath({ check, id, value, prefix, disabled, onChange, issue }: {\n check: GitHubSourceCheck | null\n id: string\n value: string\n prefix: string\n disabled: boolean\n onChange: (path: string) => void\n issue: string | null\n}) {\n const suggested = check ? prefix + basename(check.path) : ''\n // Suggest a path when a new source is checked; the person's own path stays.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => { if (suggested && !value) onChange(suggested) }, [suggested])\n return <Field label=\"Workspace path\" htmlFor={id} error={issue} hint={!issue && prefix ? `Files go under ${prefix}` : undefined}>\n <Input id={id} size=\"compact\" value={value} disabled={disabled || !check} placeholder={prefix + 'guide.md'} {...noAutofill}\n aria-invalid={issue ? true : undefined} aria-describedby={fieldMessageId(id)} onChange={event => onChange(event.target.value)} />\n </Field>\n}\n\n","import { useRef, useState } from 'react'\nimport type { AgentProfileMcpServer, AgentProfileResourceRef } from '@tangle-network/agent-interface/profile'\nimport { Button, Input } from '@tangle-network/sandbox-ui/primitives'\nimport { AgentProfileRegistryError, type AgentProfileRegistryMcpServer, type AgentProfileRegistryPort,\n type AgentProfileRegistrySkill } from './agent-profile-registry'\n\ninterface SearchState<T> {\n status: 'idle' | 'searching' | 'done'\n results: readonly T[]\n unavailable: readonly string[]\n failure: { kind: 'authorization-required' | 'unavailable' | 'failed'; message: string } | null\n}\n\nconst idle: SearchState<never> = { status: 'idle', results: [], unavailable: [], failure: null }\n\nfunction failureOf(cause: unknown): SearchState<never>['failure'] {\n if (cause instanceof AgentProfileRegistryError) return { kind: cause.kind, message: cause.message }\n return { kind: 'failed', message: cause instanceof Error ? cause.message : 'Registry search failed.' }\n}\n\nfunction failureText(failure: NonNullable<SearchState<never>['failure']>): string {\n if (failure.kind === 'authorization-required') {\n return 'Registry search needs authorization. Sign in again or ask a workspace owner.'\n }\n if (failure.kind === 'unavailable') return failure.message || 'Registry search is unavailable right now.'\n return failure.message || 'Registry search failed.'\n}\n\nfunction useRegistrySearch<T>(search: (query: string, signal: AbortSignal) => Promise<{ items: readonly T[]; unavailable?: readonly string[] }>) {\n const [state, setState] = useState<SearchState<T>>(idle as SearchState<T>)\n const request = useRef(0)\n\n async function run(query: string) {\n const text = query.trim()\n if (!text) return\n const epoch = ++request.current\n const controller = new AbortController()\n setState(current => ({ ...current, status: 'searching', failure: null }))\n try {\n const result = await search(text, controller.signal)\n if (request.current !== epoch) return\n setState({ status: 'done', results: result.items, unavailable: result.unavailable ?? [], failure: null })\n } catch (cause) {\n if (request.current !== epoch) return\n setState({ status: 'done', results: [], unavailable: [], failure: failureOf(cause) })\n }\n }\n\n return { state, run }\n}\n\nfunction SearchBox({ label, placeholder, disabled, onSearch }: {\n label: string\n placeholder: string\n disabled: boolean\n onSearch: (query: string) => void\n}) {\n const [query, setQuery] = useState('')\n return <div className=\"flex gap-2\">\n <Input aria-label={label} disabled={disabled} value={query} placeholder={placeholder}\n onChange={event => setQuery(event.target.value)}\n onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); onSearch(query) } }} />\n <Button type=\"button\" variant=\"outline\" disabled={disabled || !query.trim()} onClick={() => onSearch(query)}>Search</Button>\n </div>\n}\n\nfunction SearchStatus<T>({ state, empty }: { state: SearchState<T>; empty: string }) {\n return <>\n {state.status === 'searching' && <p role=\"status\" className=\"text-xs text-muted-foreground\">Searching…</p>}\n {state.failure && <p role=\"alert\" className=\"text-xs text-destructive\">{failureText(state.failure)}</p>}\n {!state.failure && state.unavailable.length > 0 && <p role=\"status\" className=\"text-xs text-muted-foreground\">\n Some catalogs could not answer: {state.unavailable.join(', ')}.</p>}\n {state.status === 'done' && !state.failure && state.results.length === 0 &&\n <p className=\"text-xs text-muted-foreground\">{empty}</p>}\n </>\n}\n\nexport function AgentProfileRegistrySkillSearch({ registry, disabled, existing, validate, onAdd }: {\n registry: AgentProfileRegistryPort\n disabled: boolean\n existing: readonly AgentProfileResourceRef[]\n /** Product constraints; returns the reason a result cannot be added, or null when it can. */\n validate: (ref: AgentProfileResourceRef) => string | null\n onAdd: (ref: AgentProfileResourceRef) => boolean\n}) {\n const { state, run } = useRegistrySearch<AgentProfileRegistrySkill>(async (query, signal) => {\n const result = await registry.searchSkills(query, signal)\n return { items: result.skills, unavailable: result.unavailable }\n })\n const [added, setAdded] = useState<readonly string[]>([])\n\n return <div className=\"space-y-2 rounded-lg border border-border p-3\">\n <p className=\"text-sm font-medium text-foreground\">Find skills in maintained catalogs</p>\n <p className=\"text-xs text-muted-foreground\">Search shows each skill's source and declared permissions. Adding a skill saves a reference; nothing is installed until the profile runs.</p>\n <SearchBox label=\"Search skill catalogs\" placeholder=\"Search skills\" disabled={disabled || state.status === 'searching'}\n onSearch={query => void run(query)} />\n <SearchStatus state={state} empty=\"No skills matched that search.\" />\n {state.results.length > 0 && <ul className=\"space-y-2\">{state.results.map((skill, index) => {\n const configured = existing.some(ref => ref.name === skill.name) || added.includes(skill.name)\n const issue = configured ? null : validate(skill.ref)\n return <li key={`${skill.catalog}:${skill.name}:${index}`} className=\"space-y-1 rounded-lg border border-border p-3 text-sm\"\n aria-label={`Catalog skill ${skill.name}`}>\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <span className=\"block break-words font-medium text-foreground\">{skill.name}</span>\n <span className=\"block text-xs text-muted-foreground\">{skill.catalog}</span>\n </div>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" disabled={disabled || configured || Boolean(issue)}\n aria-label={`Add skill ${skill.name}`}\n onClick={() => { if (onAdd(skill.ref)) setAdded(current => [...current, skill.name]) }}>\n {configured ? 'Added' : 'Add skill'}</Button>\n </div>\n {skill.description && <p className=\"text-xs text-muted-foreground\">{skill.description}</p>}\n {skill.ref.kind === 'github' && <p className=\"break-words text-xs text-muted-foreground\">\n Source: {skill.ref.repository} / {skill.ref.path}{skill.ref.ref ? ` @ ${skill.ref.ref}` : ''}</p>}\n {skill.permissions && skill.permissions.length > 0 &&\n <p className=\"text-xs text-muted-foreground\">Requests: {skill.permissions.join(', ')}</p>}\n {issue && <p className=\"text-xs text-destructive\">{issue}</p>}\n </li> })}</ul>}\n </div>\n}\n\nexport function AgentProfileRegistryMcpSearch({ registry, disabled, existingNames, validate, onAdd }: {\n registry: AgentProfileRegistryPort\n disabled: boolean\n existingNames: readonly string[]\n validate: (name: string, server: AgentProfileMcpServer) => string | null\n onAdd: (name: string, server: AgentProfileMcpServer) => boolean\n}) {\n const { state, run } = useRegistrySearch<AgentProfileRegistryMcpServer>(async (query, signal) => {\n const result = await registry.searchMcpServers(query, signal)\n return { items: result.mcpServers, unavailable: result.unavailable }\n })\n const [added, setAdded] = useState<readonly string[]>([])\n\n return <div className=\"space-y-2 rounded-lg border border-border p-3\">\n <p className=\"text-sm font-medium text-foreground\">Find MCP servers in registries</p>\n <p className=\"text-xs text-muted-foreground\">Results come from the official MCP Registry and configured custom registries. Listing does not imply trust or authorize installation.</p>\n <SearchBox label=\"Search MCP registries\" placeholder=\"Search MCP servers\" disabled={disabled || state.status === 'searching'}\n onSearch={query => void run(query)} />\n <SearchStatus state={state} empty=\"No MCP servers matched that search.\" />\n {state.results.length > 0 && <ul className=\"space-y-2\">{state.results.map((item, index) => {\n const configured = existingNames.includes(item.name) || added.includes(item.name)\n const issue = configured ? null : validate(item.name, item.server)\n return <li key={`${item.catalog}:${item.name}:${index}`} className=\"space-y-1 rounded-lg border border-border p-3 text-sm\"\n aria-label={`Registry server ${item.name}`}>\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <span className=\"block break-words font-medium text-foreground\">{item.name}</span>\n <span className=\"block text-xs text-muted-foreground\">{item.catalog}</span>\n </div>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" disabled={disabled || configured || Boolean(issue)}\n aria-label={`Add server ${item.name}`}\n onClick={() => { if (onAdd(item.name, item.server)) setAdded(current => [...current, item.name]) }}>\n {configured ? 'Added' : 'Add server'}</Button>\n </div>\n {item.description && <p className=\"text-xs text-muted-foreground\">{item.description}</p>}\n <p className=\"break-words text-xs text-muted-foreground\">{'command' in item.server ? `Command: ${item.server.command}` : `URL: ${item.server.url}`}</p>\n {issue && <p className=\"text-xs text-destructive\">{issue}</p>}\n </li> })}</ul>}\n </div>\n}\n","import type { AgentProfileMcpServer, AgentProfileResourceRef } from '@tangle-network/agent-interface/profile'\n\n/**\n * Registry discovery port for the shared profile editor (agent-app#776).\n * The host authenticates and bounds every search server-side; the editor\n * never talks to a catalog directly. Discovery never implies trust,\n * authorization, or installation: choosing a result only adds the canonical\n * reference to the profile draft, and the product's own constraints\n * (pinned commits, HTTPS-only endpoints, unique names) still decide whether\n * the reference may be added.\n */\n\n/** A skill offered by a maintained catalog. */\nexport interface AgentProfileRegistrySkill {\n /** Canonical skill name; the product's format and uniqueness rules still apply. */\n name: string\n /** What the skill is for, from the catalog. */\n description?: string\n /** Display name of the catalog that answered, for example `Tangle Network skills`. */\n catalog: string\n /** Permissions the skill declares, shown before the operator adds it. */\n permissions?: readonly string[]\n /** Canonical reference added to the profile when the operator chooses this skill. */\n ref: AgentProfileResourceRef\n}\n\n/** An MCP server offered by the official MCP Registry or a custom registry. */\nexport interface AgentProfileRegistryMcpServer {\n /** Canonical server name; existing profile entries win over duplicates. */\n name: string\n /** What the server provides, from the registry. */\n description?: string\n /** Display name of the registry that answered, for example `Official MCP Registry`. */\n catalog: string\n /** Canonical server entry added to the profile when the operator chooses it. */\n server: AgentProfileMcpServer\n}\n\nexport interface AgentProfileRegistrySkillsResult {\n skills: readonly AgentProfileRegistrySkill[]\n /** Catalogs that could not answer; results from the remaining catalogs stay usable. */\n unavailable?: readonly string[]\n}\n\nexport interface AgentProfileRegistryMcpResult {\n mcpServers: readonly AgentProfileRegistryMcpServer[]\n unavailable?: readonly string[]\n}\n\n/** Registry search failures the editor renders distinctly. */\nexport type AgentProfileRegistryFailure = 'authorization-required' | 'unavailable' | 'failed'\n\nexport class AgentProfileRegistryError extends Error {\n constructor(readonly kind: AgentProfileRegistryFailure, message: string) {\n super(message)\n this.name = 'AgentProfileRegistryError'\n }\n}\n\n/** Host-supplied registry search. Implementations must time out and never install anything. */\nexport interface AgentProfileRegistryPort {\n searchSkills(query: string, signal?: AbortSignal): Promise<AgentProfileRegistrySkillsResult>\n searchMcpServers(query: string, signal?: AbortSignal): Promise<AgentProfileRegistryMcpResult>\n}\n","/**\n * Layout and text conventions for the profile editor, kept in one place so\n * every section uses one type size, one spacing scale, and one control height.\n *\n * Type: 14px (`text-sm`) for labels, values, help, status, and errors; section\n * titles are 16px semibold. Nothing in the form is smaller.\n * Spacing: 8px from a label to its control, 16px between fields, 16px between\n * sections. Controls: `--control-height` for inputs, selects, pickers, and\n * buttons (`size=\"compact\"`).\n *\n * Two-column field rows respond to the editor's own width through a container\n * query, so the form stays single-column inside a narrow side panel on a wide\n * screen.\n */\nimport { useId, useState, type ReactNode } from 'react'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@tangle-network/ui/primitives'\n\nexport const formText = {\n body: 'text-sm leading-6 text-foreground',\n muted: 'text-sm leading-6 text-muted-foreground',\n error: 'text-sm leading-6 text-destructive',\n label: 'text-sm font-medium leading-6 text-foreground',\n /** Section titles are the one step up: 16px semibold. */\n title: 'text-base font-semibold leading-6 text-foreground',\n} as const\n\n/** Two fields side by side once the editor is at least 36rem wide. */\nexport const formRow = 'grid gap-4 @xl/profile-editor:grid-cols-2'\n\n/** A list row: its text, then its actions beside it when the editor is wide enough, or below it when narrow. */\nexport const listRow = 'flex flex-col gap-1 @lg/profile-editor:flex-row @lg/profile-editor:items-start @lg/profile-editor:justify-between @lg/profile-editor:gap-3'\n\n/** Row actions are ghost buttons; pulling them left by their padding lines their text up with the row's text when stacked. */\nexport const rowActions = 'flex shrink-0 flex-wrap gap-1 -ml-3 @lg/profile-editor:ml-0'\n\nfunction InfoGlyph({ className }: { className?: string }) {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"M12 16v-4M12 8h.01\" />\n </svg>\n}\n\n/**\n * An info button beside a label. It opens on hover and keyboard focus, and\n * toggles on tap, so the help is reachable on touch screens too.\n */\nfunction InfoHint({ label, children }: { label: string; children: ReactNode }) {\n const [open, setOpen] = useState(false)\n return <Tooltip open={open} onOpenChange={setOpen} delayDuration={150}>\n <TooltipTrigger asChild>\n <button type=\"button\" aria-label={`About ${label}`} onClick={() => setOpen(current => !current)}\n className=\"inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\">\n <InfoGlyph className=\"size-4\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-72 text-sm leading-5\">{children}</TooltipContent>\n </Tooltip>\n}\n\nexport interface FieldProps {\n label: string\n /** The control's id; the label targets it. */\n htmlFor: string\n /** Help that explains what the setting does, shown from an info button. */\n info?: ReactNode\n /** One short sentence the person needs to fill the field in. */\n hint?: ReactNode\n /** A validation error. The control should set `aria-invalid` and reference {@link fieldMessageId}. */\n error?: ReactNode\n /** A non-error status, such as a check that passed. */\n status?: ReactNode\n /** Trailing content in the label row, such as a \"Use default\" action. */\n aside?: ReactNode\n children: ReactNode\n}\n\n/** The id of a field's hint, error, or status line, for the control's `aria-describedby`. */\nexport function fieldMessageId(htmlFor: string): string {\n return `${htmlFor}-message`\n}\n\nexport function Field({ label, htmlFor, info, hint, error, status, aside, children }: FieldProps) {\n const message = error ?? status ?? hint\n return <div className=\"min-w-0 space-y-2\">\n <div className=\"flex min-h-6 items-center justify-between gap-2\">\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <label htmlFor={htmlFor} className={formText.label}>{label}</label>\n {info && <InfoHint label={label}>{info}</InfoHint>}\n </span>\n {aside}\n </div>\n {children}\n {message && <div id={fieldMessageId(htmlFor)} role={error ? 'alert' : undefined}\n className={error ? formText.error : formText.muted}>{message}</div>}\n </div>\n}\n\nexport interface SectionProps {\n title: string\n /** One sentence on what the section controls. */\n description?: ReactNode\n /** Short trailing summary, such as \"3 skills\". */\n summary?: ReactNode\n /** Collapsible sections start closed unless this is set. */\n defaultOpen?: boolean\n collapsible?: boolean\n children: ReactNode\n}\n\nfunction Chevron({ className }: { className?: string }) {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m6 9 6 6 6-6\" /></svg>\n}\n\n/** A bordered section. Collapsible sections use a native disclosure so they work without script. */\nexport function Section({ title, description, summary, defaultOpen = false, collapsible = false, children }: SectionProps) {\n const headingId = useId()\n const header = <span className=\"flex min-w-0 flex-1 items-start justify-between gap-3\">\n <span className=\"min-w-0 space-y-0.5\">\n <span id={headingId} className={`block ${formText.title}`}>{title}</span>\n {description && <span className={`block ${formText.muted}`}>{description}</span>}\n </span>\n {(summary || collapsible) && <span className={`flex shrink-0 items-center gap-2 ${formText.muted}`}>\n {summary}\n {collapsible && <Chevron className=\"size-4 transition-transform group-open:rotate-180\" />}\n </span>}\n </span>\n if (!collapsible) {\n return <section aria-labelledby={headingId} className=\"min-w-0 rounded-xl border border-border bg-card\">\n <header className=\"flex px-4 pt-4\">{header}</header>\n <div className=\"min-w-0 space-y-4 p-4\">{children}</div>\n </section>\n }\n return <details open={defaultOpen || undefined} className=\"group min-w-0 rounded-xl border border-border bg-card\">\n <summary aria-labelledby={headingId} className=\"flex cursor-pointer list-none rounded-xl p-4 marker:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden\">\n {header}\n </summary>\n <div className=\"min-w-0 space-y-4 border-t border-border p-4\">{children}</div>\n </details>\n}\n\nexport type StatusTone = 'neutral' | 'pending' | 'success' | 'warning' | 'error'\n\nconst toneClass: Record<StatusTone, string> = {\n neutral: 'text-muted-foreground',\n pending: 'text-muted-foreground',\n success: 'text-[var(--surface-success-text,hsl(var(--success)))]',\n warning: 'text-warning-strong',\n error: 'text-destructive',\n}\n\nfunction StatusGlyph({ tone }: { tone: StatusTone }) {\n if (tone === 'pending') {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0 animate-spin motion-reduce:animate-none\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\"><path d=\"M21 12a9 9 0 1 1-6.2-8.6\" /></svg>\n }\n if (tone === 'success') {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"m8 12 3 3 5-6\" /></svg>\n }\n if (tone === 'error' || tone === 'warning') {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"M12 8v4M12 16h.01\" /></svg>\n }\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><circle cx=\"12\" cy=\"12\" r=\"3\" /></svg>\n}\n\n/** An inline status with an icon: a check in progress, a passed check, or a failure. */\nexport function StatusLine({ tone, children, id }: { tone: StatusTone; children: ReactNode; id?: string }) {\n return <p id={id} role={tone === 'error' ? 'alert' : 'status'} className={`flex items-start gap-2 text-sm leading-6 ${toneClass[tone]}`}>\n <span className=\"flex h-6 items-center\"><StatusGlyph tone={tone} /></span>\n <span className=\"min-w-0 break-words [overflow-wrap:anywhere]\">{children}</span>\n </p>\n}\n\n/** A short state label with a dot, for list rows. */\nexport function StatusPill({ tone, children }: { tone: StatusTone; children: ReactNode }) {\n return <span className={`inline-flex shrink-0 items-center gap-1.5 text-sm leading-6 ${toneClass[tone]}`}>\n {tone === 'pending'\n ? <StatusGlyph tone=\"pending\" />\n : <span aria-hidden=\"true\" className=\"size-2 rounded-full bg-current\" />}\n {children}\n </span>\n}\n\n/** A banner for a form-wide state, such as an error the person must fix before saving. */\nexport function Notice({ tone, children }: { tone: 'error' | 'info'; children: ReactNode }) {\n return <div role={tone === 'error' ? 'alert' : 'status'} className={`rounded-lg border p-3 text-sm leading-6 ${tone === 'error'\n ? 'border-destructive/40 bg-destructive/5 text-foreground'\n : 'border-border bg-muted/50 text-foreground'}`}>{children}</div>\n}\n\n/** Attributes that keep password managers and browser autofill off fields that are not credentials. */\nexport const noAutofill = {\n autoComplete: 'off',\n 'data-1p-ignore': 'true',\n 'data-lpignore': 'true',\n 'data-bwignore': 'true',\n 'data-form-type': 'other',\n spellCheck: false,\n} as const\n","/**\n * Choose a file from GitHub for a skill or a resource file. Repositories and\n * paths autocomplete from the workspace's GitHub connection, the version is the\n * default branch's latest commit unless the person pins a SHA, and the chosen\n * file is read and checked before it can be added.\n */\nimport { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'\nimport { Button, Input } from '@tangle-network/sandbox-ui/primitives'\nimport { SegmentedControl } from '@tangle-network/ui/primitives'\nimport {\n isCommitSha, parseGitHubLocation,\n type GitHubCommitSummary, type GitHubFileList, type GitHubRepositorySummary, type GitHubSourceCheck,\n type GitHubSourceFailure, type GitHubSourceOutcome, type GitHubSourcePurpose, type ProfileEditorGitHubPort,\n} from '../profile-editor'\nimport { Field, fieldMessageId, formRow, formText, noAutofill, StatusLine } from './agent-profile-form-kit'\nimport { SuggestInput, type Suggestion } from './agent-profile-suggest-input'\n\ntype Load<T> = { state: 'idle' } | { state: 'loading' } | { state: 'done'; value: T } | { state: 'failed'; failure: GitHubSourceFailure }\n\n/** Run a lookup whenever its key changes, cancelling the previous one. */\nfunction useLookup<T>(key: string | null, run: (signal: AbortSignal) => Promise<GitHubSourceOutcome<T>>, delayMs = 0): Load<T> {\n const [load, setLoad] = useState<Load<T>>({ state: 'idle' })\n const runRef = useRef(run)\n runRef.current = run\n useEffect(() => {\n if (key === null) { setLoad({ state: 'idle' }); return }\n const controller = new AbortController()\n setLoad({ state: 'loading' })\n const timer = setTimeout(() => {\n runRef.current(controller.signal).then(outcome => {\n if (controller.signal.aborted) return\n setLoad(outcome.ok ? { state: 'done', value: outcome.value } : { state: 'failed', failure: outcome })\n }, (cause: unknown) => {\n if (controller.signal.aborted) return\n setLoad({ state: 'failed', failure: { ok: false, problem: 'unavailable', message: cause instanceof Error ? cause.message : 'The lookup failed.' } })\n })\n }, delayMs)\n return () => { clearTimeout(timer); controller.abort() }\n }, [key, delayMs])\n return load\n}\n\nfunction shortSha(sha: string): string {\n return sha.slice(0, 7)\n}\n\nfunction relativeDate(iso?: string): string | null {\n if (!iso) return null\n const time = Date.parse(iso)\n if (Number.isNaN(time)) return null\n const days = Math.floor((Date.now() - time) / 86_400_000)\n if (days <= 0) return 'today'\n if (days === 1) return 'yesterday'\n if (days < 30) return `${days} days ago`\n return new Date(time).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })\n}\n\nfunction describeCommit(commit: GitHubCommitSummary): string {\n const when = relativeDate(commit.committedAt)\n return [shortSha(commit.sha), commit.message, when].filter(Boolean).join(' · ')\n}\n\nfunction rankPaths(files: GitHubFileList['files'], query: string, purpose: GitHubSourcePurpose): Suggestion[] {\n const needle = query.trim().toLowerCase()\n const candidates = purpose === 'skill' ? files.filter(file => /(^|\\/)SKILL\\.md$/i.test(file.path)) : files\n const pool = candidates.length || purpose !== 'skill' ? candidates : files\n return pool\n .filter(file => !needle || file.path.toLowerCase().includes(needle))\n .sort((left, right) => {\n const leftStarts = needle && left.path.toLowerCase().startsWith(needle) ? 0 : 1\n const rightStarts = needle && right.path.toLowerCase().startsWith(needle) ? 0 : 1\n return leftStarts - rightStarts || left.path.split('/').length - right.path.split('/').length || left.path.localeCompare(right.path)\n })\n .slice(0, 50)\n .map(file => ({ value: file.path, label: file.path }))\n}\n\ninterface GitHubSourceSelection {\n check: GitHubSourceCheck\n}\n\nexport interface GitHubSourcePickerProps {\n port: ProfileEditorGitHubPort\n purpose: GitHubSourcePurpose\n disabled?: boolean\n /** Where the person connects GitHub, shown when the workspace has no connection. */\n connectHref?: string\n /** Called with the checked source. The caller adds it to the profile and closes the picker. */\n onChoose: (selection: GitHubSourceSelection) => void\n /** The label for the add action, for example \"Add skill\". */\n actionLabel: string\n /** Fields the caller needs beside the source, such as the skill name; rendered above the action. */\n children?: (check: GitHubSourceCheck | null) => ReactNode\n /** The reason the caller's fields block adding, or null. */\n blocked?: string | null\n /** Initial values, for editing an existing GitHub source. */\n initial?: { repository?: string; path?: string; ref?: string }\n onCancel: () => void\n}\n\nexport function GitHubSourcePicker({ port, purpose, disabled = false, connectHref, onChoose, actionLabel, children, blocked = null, initial, onCancel }: GitHubSourcePickerProps) {\n const uid = useId()\n const fieldId = (name: 'repository' | 'version' | 'sha' | 'path') => `github-${name}${uid}`\n\n const [repositoryText, setRepositoryText] = useState(initial?.repository ?? '')\n const [repository, setRepository] = useState(initial?.repository ?? '')\n const [version, setVersion] = useState<'latest' | 'pinned'>(initial?.ref && isCommitSha(initial.ref) ? 'pinned' : 'latest')\n const [shaText, setShaText] = useState(initial?.ref && isCommitSha(initial.ref) ? initial.ref : '')\n const [pathText, setPathText] = useState(initial?.path ?? '')\n const [path, setPath] = useState(initial?.path ?? '')\n\n const repositories = useLookup('repositories', signal => port.repositories(signal))\n const latest = useLookup(repository || null, signal => port.latest(repository, signal))\n const pinnedSha = version === 'pinned' && isCommitSha(shaText.trim()) ? shaText.trim().toLowerCase() : null\n const pinned = useLookup(repository && pinnedSha ? `${repository}@${pinnedSha}` : null,\n signal => port.commit(repository, pinnedSha!, signal), 300)\n const commit: GitHubCommitSummary | null = version === 'latest'\n ? latest.state === 'done' ? latest.value.commit : null\n : pinned.state === 'done' ? pinned.value : null\n const files = useLookup(repository && commit ? `${repository}@${commit.sha}` : null,\n signal => port.files(repository, commit!.sha, signal))\n const check = useLookup(repository && commit && path ? `${repository}@${commit.sha}:${path}:${purpose}` : null,\n signal => port.check({ repository, path, commit: commit!.sha, purpose }, signal), 150)\n\n const notConnected = repositories.state === 'failed' && repositories.failure.problem === 'not-connected'\n ? repositories.failure\n : latest.state === 'failed' && latest.failure.problem === 'not-connected' ? latest.failure : null\n\n const repositorySuggestions = useMemo<Suggestion[]>(() => {\n if (repositories.state !== 'done') return []\n const needle = repositoryText.trim().toLowerCase()\n return repositories.value.repositories\n .filter((item: GitHubRepositorySummary) => !needle || item.fullName.toLowerCase().includes(needle))\n .slice(0, 50)\n .map(item => ({ value: item.fullName, label: item.fullName,\n detail: [item.private ? 'Private' : 'Public', item.description].filter(Boolean).join(' · ') }))\n }, [repositories, repositoryText])\n\n const pathSuggestions = useMemo(() => files.state === 'done' ? rankPaths(files.value.files, pathText, purpose) : [],\n [files, pathText, purpose])\n\n function commitRepository(text: string) {\n const location = parseGitHubLocation(text)\n if (!location) { setRepository(''); return }\n setRepositoryText(location.repository)\n setRepository(location.repository)\n if (location.ref && isCommitSha(location.ref)) { setVersion('pinned'); setShaText(location.ref) }\n if (location.path) { setPathText(location.path); setPath(location.path) }\n }\n\n if (notConnected) {\n return <div className=\"space-y-3\">\n <StatusLine tone=\"neutral\">{notConnected.message}</StatusLine>\n <div className=\"flex flex-wrap gap-2\">\n {connectHref && <Button asChild size=\"compact\"><a href={connectHref}>Connect GitHub</a></Button>}\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n }\n\n const repositoryInvalid = repositoryText.trim() !== '' && repository === '' && !parseGitHubLocation(repositoryText)\n const repositoryMessage = repositoryInvalid\n ? <span className={formText.error}>Enter a repository as owner/repo, or paste its GitHub link.</span>\n : latest.state === 'failed' ? <span className={formText.error}>{latest.failure.message}</span>\n : latest.state === 'loading' ? <StatusLine tone=\"pending\">Checking {repository}…</StatusLine>\n : latest.state === 'done' ? <StatusLine tone=\"success\">{latest.value.repository.private ? 'Private' : 'Public'} · default branch {latest.value.repository.defaultBranch}</StatusLine>\n : repositories.state === 'failed' ? <span className={formText.muted}>{repositories.failure.message}</span>\n : undefined\n const shaInvalid = version === 'pinned' && shaText.trim() !== '' && !isCommitSha(shaText.trim())\n const versionMessage = version === 'latest'\n ? latest.state === 'done' ? <span className={formText.muted}>{describeCommit(latest.value.commit)}</span> : undefined\n : shaInvalid ? <span className={formText.error}>Enter the full 40-character commit SHA.</span>\n : pinned.state === 'failed' ? <span className={formText.error}>{pinned.failure.message}</span>\n : pinned.state === 'loading' ? <StatusLine tone=\"pending\">Looking up the commit…</StatusLine>\n : pinned.state === 'done' ? <StatusLine tone=\"success\">{describeCommit(pinned.value)}</StatusLine>\n : undefined\n const checked = check.state === 'done' ? check.value : null\n const pathMessage = !commit ? undefined\n : files.state === 'failed' ? <span className={formText.error}>{files.failure.message}</span>\n : check.state === 'loading' ? <StatusLine tone=\"pending\">Reading {path}…</StatusLine>\n : check.state === 'failed' ? <span className={formText.error}>{check.failure.message}</span>\n : checked ? <StatusLine tone=\"success\">{checked.skill\n ? <>Skill <span className=\"font-medium\">{checked.skill.name}</span>: {checked.skill.description}</>\n : <>{checked.path} · {Math.max(1, Math.round(checked.size / 1024))} KB</>}</StatusLine>\n : files.state === 'done' && files.value.truncated ? <span className={formText.muted}>This repository is large; type the full path if it is not suggested.</span>\n : undefined\n const ready = checked !== null && !blocked && !disabled\n\n return <div className=\"space-y-4\">\n <Field label=\"Repository\" htmlFor={fieldId('repository')} error={undefined} hint={repositoryMessage}>\n <SuggestInput id={fieldId('repository')} value={repositoryText} disabled={disabled}\n placeholder={repositories.state === 'done' ? 'Search your repositories' : 'owner/repo'}\n onChange={setRepositoryText} onCommit={commitRepository}\n suggestions={repositorySuggestions} loading={repositories.state === 'loading' && repositoryText === ''}\n emptyText={repositories.state === 'done' ? 'No matching repositories. Press Enter to use what you typed.' : undefined}\n invalid={repositoryInvalid || latest.state === 'failed'} describedBy={fieldMessageId(fieldId('repository'))} />\n </Field>\n <div className={formRow}>\n <Field label=\"Version\" htmlFor={fieldId('version')} hint={versionMessage}>\n <SegmentedControl id={fieldId('version')} aria-label=\"Version\" value={version}\n onValueChange={next => setVersion(next)}\n options={[{ value: 'latest', label: 'Latest commit' }, { value: 'pinned', label: 'Pin a commit' }]}\n className=\"h-[var(--control-height)] w-full flex-nowrap p-0.5 [&_button]:h-full [&_button]:flex-1 [&_button]:justify-center [&_button]:py-0\" />\n </Field>\n {version === 'pinned' && <Field label=\"Commit SHA\" htmlFor={fieldId('sha')}>\n <Input id={fieldId('sha')} size=\"compact\" value={shaText} disabled={disabled} placeholder=\"40-character SHA\"\n aria-invalid={shaInvalid || pinned.state === 'failed' || undefined} {...noAutofill}\n className=\"font-mono\" onChange={event => setShaText(event.target.value)} />\n </Field>}\n </div>\n <Field label={purpose === 'skill' ? 'Skill file' : 'File'} htmlFor={fieldId('path')} hint={pathMessage}>\n <SuggestInput id={fieldId('path')} value={pathText} disabled={disabled || !commit}\n placeholder={purpose === 'skill' ? 'skills/research/SKILL.md' : 'docs/guide.md'}\n onChange={setPathText} onCommit={next => setPath(next)}\n suggestions={pathSuggestions} loading={files.state === 'loading'}\n emptyText={files.state === 'done' ? (purpose === 'skill' ? 'No SKILL.md files match.' : 'No files match.') : undefined}\n invalid={check.state === 'failed'} describedBy={fieldMessageId(fieldId('path'))} />\n </Field>\n {children?.(checked)}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" size=\"compact\" disabled={!ready} onClick={() => { if (checked) onChoose({ check: checked }) }}>{actionLabel}</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n}\n","/**\n * A text field with a suggestion list: type to filter, arrow keys to move,\n * Enter to choose. The person may also keep what they typed, so a value the\n * suggestions do not contain (a repository the listing missed, a path in a\n * truncated tree) is still enterable. The list renders through\n * `PopoverSurface`, so a scrolling side panel cannot clip it.\n */\nimport { useEffect, useId, useRef, useState, type ReactNode } from 'react'\nimport { Input } from '@tangle-network/sandbox-ui/primitives'\nimport { OVERLAY_SHADOW, PopoverSurface, POPOVER_OPTION_FOCUS } from './controls'\nimport { noAutofill } from './agent-profile-form-kit'\n\nexport interface Suggestion {\n value: string\n label: ReactNode\n detail?: ReactNode\n}\n\nexport interface SuggestInputProps {\n id: string\n value: string\n onChange: (value: string) => void\n /** Called when the person chooses a suggestion, presses Enter, or leaves the field with a changed value. */\n onCommit: (value: string) => void\n suggestions: readonly Suggestion[]\n /** Shown in the list while suggestions load. */\n loading?: boolean\n /** Shown when the list is open but nothing matches. */\n emptyText?: string\n placeholder?: string\n disabled?: boolean\n invalid?: boolean\n describedBy?: string\n 'aria-label'?: string\n}\n\nexport function SuggestInput({ id, value, onChange, onCommit, suggestions, loading = false, emptyText, placeholder,\n disabled = false, invalid = false, describedBy, 'aria-label': ariaLabel }: SuggestInputProps) {\n const [open, setOpen] = useState(false)\n const [active, setActive] = useState(-1)\n const inputRef = useRef<HTMLInputElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n const committed = useRef(value)\n const listId = useId()\n const optionId = (index: number) => `${listId}-option-${index}`\n const showList = open && !disabled && (loading || suggestions.length > 0 || Boolean(emptyText && value.trim()))\n\n useEffect(() => { setActive(-1) }, [suggestions])\n useEffect(() => { if (disabled) setOpen(false) }, [disabled])\n\n function commit(next: string) {\n setOpen(false)\n setActive(-1)\n if (next !== committed.current) {\n committed.current = next\n onCommit(next)\n }\n }\n function choose(index: number) {\n const suggestion = suggestions[index]\n if (!suggestion) return\n onChange(suggestion.value)\n committed.current = ''\n commit(suggestion.value)\n }\n\n return <div className=\"relative min-w-0\">\n <Input ref={inputRef} id={id} size=\"compact\" value={value} disabled={disabled} placeholder={placeholder}\n role=\"combobox\" aria-autocomplete=\"list\" aria-expanded={showList} aria-controls={showList ? listId : undefined}\n aria-activedescendant={showList && active >= 0 ? optionId(active) : undefined}\n aria-invalid={invalid || undefined} aria-describedby={describedBy} aria-label={ariaLabel}\n {...noAutofill}\n onFocus={() => setOpen(true)}\n onChange={event => { onChange(event.target.value); setOpen(true) }}\n onBlur={event => {\n // Choosing a row keeps focus in the field (rows prevent mousedown), so a blur here leaves the control.\n if (panelRef.current?.contains(event.relatedTarget as Node | null)) return\n commit(value.trim())\n }}\n onKeyDown={event => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n if (!suggestions.length) return\n const step = event.key === 'ArrowDown' ? 1 : -1\n setActive(current => (current + step + suggestions.length) % suggestions.length)\n } else if (event.key === 'Enter') {\n event.preventDefault()\n if (showList && active >= 0) choose(active)\n else commit(value.trim())\n } else if (event.key === 'Escape' && showList) {\n event.preventDefault()\n event.stopPropagation()\n setOpen(false)\n }\n }} />\n <PopoverSurface open={showList} id={listId} role=\"listbox\" aria-label={ariaLabel ?? 'Suggestions'} triggerRef={inputRef} panelRef={panelRef}\n matchTriggerWidth side=\"below\" contentKey={suggestions}\n className={`max-h-72 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 text-foreground ${OVERLAY_SHADOW}`}>\n {loading && <div role=\"status\" className=\"px-3 py-2 text-sm text-muted-foreground\">Loading…</div>}\n {!loading && suggestions.length === 0 && emptyText && <div className=\"px-3 py-2 text-sm text-muted-foreground\">{emptyText}</div>}\n {suggestions.map((suggestion, index) => <div key={suggestion.value} id={optionId(index)} role=\"option\" aria-selected={index === active}\n tabIndex={-1}\n onMouseDown={event => event.preventDefault()}\n onMouseEnter={() => setActive(index)}\n onClick={() => choose(index)}\n className={`flex min-h-9 cursor-pointer flex-col justify-center rounded-md px-3 py-1.5 text-sm ${POPOVER_OPTION_FOCUS} ${index === active ? 'bg-accent' : ''}`}>\n <span className=\"min-w-0 break-words [overflow-wrap:anywhere]\">{suggestion.label}</span>\n {suggestion.detail && <span className=\"min-w-0 break-words text-sm text-muted-foreground [overflow-wrap:anywhere]\">{suggestion.detail}</span>}\n </div>)}\n </PopoverSurface>\n </div>\n}\n","/**\n * MCP servers in the profile: turn each on or off, see whether it answers and\n * which tools it offers, and add or edit a server by its address. Headers,\n * environment, and secret references stay in Advanced JSON.\n *\n * Turning a server off keeps its address in `metadata.enabledConfig`, because\n * the canonical schema does not let a disabled entry carry a URL or command;\n * turning it back on restores that configuration.\n */\nimport { useEffect, useId, useMemo, useRef, useState } from 'react'\nimport type { AgentProfileMcpServer } from '@tangle-network/agent-interface/profile'\nimport { Button, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch } from '@tangle-network/sandbox-ui/primitives'\nimport { publicHttpsUrlProblem, type McpHealth, type ProfileEditorMcpPort } from '../profile-editor'\nimport { Field, fieldMessageId, formRow, formText, noAutofill, StatusPill, type StatusTone } from './agent-profile-form-kit'\nimport type { AgentProfileRegistryPort } from './agent-profile-registry'\nimport { AgentProfileRegistryMcpSearch } from './agent-profile-registry-search'\n\ntype Transport = 'http' | 'sse' | 'stdio'\ntype Servers = Record<string, AgentProfileMcpServer>\n\nconst NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/\n\n/** The configuration a disabled server keeps so it can be turned back on. */\nfunction enabledConfig(server: AgentProfileMcpServer): AgentProfileMcpServer | null {\n if (server.enabled !== false) return server\n const stored = server.metadata?.enabledConfig\n if (!stored || typeof stored !== 'object') return null\n const config = stored as Record<string, unknown>\n if (typeof config.url !== 'string' && typeof config.command !== 'string') return null\n return config as unknown as AgentProfileMcpServer\n}\n\nfunction withoutKeys<T extends object>(value: T, keys: readonly string[]): Record<string, unknown> {\n return Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)))\n}\n\n/** Disable a server and keep the configuration it needs to come back on. */\nfunction disableMcpServer(server: AgentProfileMcpServer): AgentProfileMcpServer {\n if (server.enabled === false) return server\n const config = withoutKeys(server, ['enabled', 'metadata'])\n return { enabled: false, metadata: { ...(server.metadata ?? {}), enabledConfig: config } }\n}\n\n/** Enable a server from its stored configuration, or null when it has none. */\nfunction enableMcpServer(server: AgentProfileMcpServer): AgentProfileMcpServer | null {\n if (server.enabled !== false) return server\n const config = enabledConfig(server)\n if (!config) return null\n const metadata = withoutKeys(server.metadata ?? {}, ['enabledConfig'])\n return { ...(config as object), ...(Object.keys(metadata).length ? { metadata } : {}) } as AgentProfileMcpServer\n}\n\nfunction serverTransport(server: AgentProfileMcpServer | null): Transport {\n if (!server) return 'http'\n if ('command' in server && server.command) return 'stdio'\n return 'transport' in server && server.transport === 'sse' ? 'sse' : 'http'\n}\n\nfunction serverTarget(server: AgentProfileMcpServer | null): string {\n if (!server) return ''\n if ('command' in server && server.command) return server.command\n return 'url' in server && server.url ? server.url : ''\n}\n\nfunction healthKey(server: AgentProfileMcpServer): string {\n return JSON.stringify(['url' in server ? server.url : null, 'transport' in server ? server.transport : null, 'headers' in server ? server.headers : null])\n}\n\nfunction healthStatus(health: McpHealth | 'checking' | undefined): { tone: StatusTone; label: string } {\n if (health === 'checking') return { tone: 'pending', label: 'Checking' }\n if (!health) return { tone: 'neutral', label: 'Not checked' }\n if (health.ok) return { tone: 'success', label: `Connected · ${health.tools.length} ${health.tools.length === 1 ? 'tool' : 'tools'}` }\n const labels: Record<Exclude<McpHealth, { ok: true }>['problem'], [StatusTone, string]> = {\n 'auth-required': ['warning', 'Needs credentials'],\n 'invalid-url': ['error', 'Invalid address'],\n 'blocked-url': ['error', 'Address not allowed'],\n 'not-checkable': ['neutral', 'Checked at run time'],\n unreachable: ['error', 'Unreachable'],\n timeout: ['error', 'Timed out'],\n 'protocol-error': ['error', 'Not an MCP server'],\n unavailable: ['warning', 'Check unavailable'],\n }\n const [tone, label] = labels[health.problem]\n return { tone, label }\n}\n\nexport interface McpServersEditorProps {\n servers: Servers\n /** Apply the next server map to the profile. Returns false when the profile rejected it. */\n onChange: (next: Servers) => boolean\n port?: ProfileEditorMcpPort\n disabled: boolean\n /** Explain why servers cannot be changed here, for example a missing role. */\n lockReason?: string\n publicHttpsOnly: boolean\n allowLocalCommand: boolean\n registry?: AgentProfileRegistryPort\n /** Report an open add or edit form, so the host can hold its save. */\n onPendingChange?: (pending: boolean) => void\n}\n\ninterface Draft { name: string; transport: Transport; target: string }\n\nfunction targetProblem(draft: Draft, publicHttpsOnly: boolean): string | null {\n const target = draft.target.trim()\n if (!target) return null\n if (draft.transport === 'stdio') return /[\\u0000-\\u001f\\u007f]/.test(target) ? 'Remove control characters from the command.' : null\n if (publicHttpsOnly) return publicHttpsUrlProblem(target)\n try {\n const url = new URL(target)\n return url.protocol === 'https:' || url.protocol === 'http:' ? null : 'Use an http:// or https:// address.'\n } catch { return 'Enter a full URL, such as https://example.com/mcp.' }\n}\n\nfunction serverFromDraft(draft: Draft, previous?: AgentProfileMcpServer): AgentProfileMcpServer {\n const target = draft.target.trim()\n const metadata = previous?.metadata ? withoutKeys(previous.metadata, ['enabledConfig']) : undefined\n const keep = metadata && Object.keys(metadata).length ? { metadata } : {}\n const prior = previous ? enabledConfig(previous) : null\n if (draft.transport === 'stdio') {\n const extras = prior && 'command' in prior ? withoutKeys(prior, ['command', 'transport', 'enabled', 'metadata', 'url', 'headers']) : {}\n return { ...extras, command: target, ...keep } as AgentProfileMcpServer\n }\n const headers = prior && 'headers' in prior && prior.headers ? { headers: prior.headers } : {}\n return { transport: draft.transport, url: target, ...headers, ...keep }\n}\n\nfunction ServerForm({ draft, onDraft, existingNames, nameEditable, publicHttpsOnly, allowLocalCommand, disabled, submitLabel, onSubmit, onCancel }: {\n draft: Draft\n onDraft: (draft: Draft) => void\n existingNames: readonly string[]\n nameEditable: boolean\n publicHttpsOnly: boolean\n allowLocalCommand: boolean\n disabled: boolean\n submitLabel: string\n onSubmit: () => void\n onCancel: () => void\n}) {\n const id = useId()\n const name = draft.name.trim()\n const nameProblem = !nameEditable || !name ? null\n : !NAME_PATTERN.test(name) ? 'Use up to 64 letters, numbers, dots, dashes, or underscores.'\n : existingNames.includes(name) ? 'A server with this name already exists.' : null\n const problem = targetProblem(draft, publicHttpsOnly)\n const ready = !disabled && (!nameEditable || (name && !nameProblem)) && draft.target.trim() && !problem\n return <div className=\"space-y-4 rounded-lg border border-border bg-muted/30 p-4\">\n <div className={formRow}>\n {nameEditable && <Field label=\"Name\" htmlFor={`${id}-name`} error={nameProblem}>\n <Input id={`${id}-name`} size=\"compact\" value={draft.name} disabled={disabled} placeholder=\"search\" {...noAutofill}\n aria-invalid={nameProblem ? true : undefined} aria-describedby={nameProblem ? fieldMessageId(`${id}-name`) : undefined}\n onChange={event => onDraft({ ...draft, name: event.target.value })} />\n </Field>}\n <Field label=\"Connection\" htmlFor={`${id}-transport`}>\n <Select disabled={disabled} value={draft.transport} onValueChange={value => onDraft({ ...draft, transport: value as Transport })}>\n <SelectTrigger id={`${id}-transport`} size=\"compact\" className=\"shadow-none\"><SelectValue /></SelectTrigger>\n <SelectContent>\n <SelectItem value=\"http\">Streamable HTTP</SelectItem>\n <SelectItem value=\"sse\">Server-sent events</SelectItem>\n {(allowLocalCommand || draft.transport === 'stdio') && <SelectItem value=\"stdio\">Local command</SelectItem>}\n </SelectContent>\n </Select>\n </Field>\n </div>\n <Field label={draft.transport === 'stdio' ? 'Command' : 'URL'} htmlFor={`${id}-target`} error={problem}\n hint={draft.transport === 'stdio' ? 'Runs inside the agent workspace.' : undefined}>\n <Input id={`${id}-target`} size=\"compact\" value={draft.target} disabled={disabled} {...noAutofill}\n inputMode={draft.transport === 'stdio' ? 'text' : 'url'}\n placeholder={draft.transport === 'stdio' ? 'npx -y @modelcontextprotocol/server-memory' : 'https://example.com/mcp'}\n aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(`${id}-target`)}\n onChange={event => onDraft({ ...draft, target: event.target.value })}\n onKeyDown={event => { if (event.key === 'Enter' && ready) { event.preventDefault(); onSubmit() } }} />\n </Field>\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" size=\"compact\" disabled={!ready} onClick={onSubmit}>{submitLabel}</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n}\n\nexport function McpServersEditor({ servers, onChange, port, disabled, lockReason, publicHttpsOnly, allowLocalCommand, registry, onPendingChange }: McpServersEditorProps) {\n const [health, setHealth] = useState<Record<string, { key: string; result: McpHealth | 'checking' }>>({})\n const [recheck, setRecheck] = useState<Record<string, number>>({})\n const [editing, setEditing] = useState<{ name: string; draft: Draft; reason?: string } | null>(null)\n const [adding, setAdding] = useState<Draft | null>(null)\n const controllers = useRef(new Map<string, AbortController>())\n const locked = lockReason !== undefined\n const entries = useMemo(() => Object.entries(servers), [servers])\n\n // Check every enabled remote server once per configuration, and again on request.\n useEffect(() => {\n if (!port) return\n for (const [name, server] of entries) {\n if (server.enabled === false || ('command' in server && server.command)) continue\n const key = `${healthKey(server)}#${recheck[name] ?? 0}`\n if (health[name]?.key === key) continue\n controllers.current.get(name)?.abort()\n const controller = new AbortController()\n controllers.current.set(name, controller)\n setHealth(current => ({ ...current, [name]: { key, result: 'checking' } }))\n port.check(server, controller.signal).then(result => {\n if (!controller.signal.aborted) setHealth(current => ({ ...current, [name]: { key, result } }))\n }, () => {\n if (!controller.signal.aborted) {\n setHealth(current => ({ ...current, [name]: { key, result: { ok: false, problem: 'unavailable', message: 'The check could not run.', checkedAt: new Date().toISOString() } } }))\n }\n })\n }\n }, [entries, port, recheck, health])\n useEffect(() => () => { for (const controller of controllers.current.values()) controller.abort() }, [])\n const pending = editing !== null || adding !== null\n useEffect(() => { onPendingChange?.(pending) }, [pending, onPendingChange])\n\n function setServer(name: string, server: AgentProfileMcpServer | null) {\n const next = { ...servers }\n if (server) next[name] = server\n else delete next[name]\n return onChange(next)\n }\n\n function toggle(name: string, server: AgentProfileMcpServer, on: boolean) {\n if (!on) { setServer(name, disableMcpServer(server)); return }\n const enabled = enableMcpServer(server)\n if (enabled) { setServer(name, enabled); return }\n setEditing({ name, draft: { name, transport: 'http', target: '' }, reason: 'Add the server address to turn it on.' })\n }\n\n return <div className=\"space-y-4\">\n {entries.length === 0 && <p className={formText.muted}>No MCP servers yet.</p>}\n {entries.length > 0 && <ul className=\"divide-y divide-border rounded-lg border border-border\">\n {entries.map(([name, server]) => {\n const on = server.enabled !== false\n const config = enabledConfig(server)\n const local = serverTransport(config) === 'stdio'\n const target = serverTarget(config)\n const result = health[name]?.result\n const status = !on ? { tone: 'neutral' as const, label: 'Off' }\n : local ? { tone: 'neutral' as const, label: 'Checked at run time' }\n : port ? healthStatus(result) : { tone: 'neutral' as const, label: 'Not checked' }\n const description = typeof server.metadata?.description === 'string' ? server.metadata.description : null\n const policyProblem = on && !local && publicHttpsOnly && target ? publicHttpsUrlProblem(target) : null\n const toggleId = `mcp-${name}-toggle`\n return <li key={name} className=\"space-y-3 p-3\" aria-label={`MCP server ${name}`}>\n <div className=\"flex items-start gap-3\">\n <span className=\"flex h-6 items-center\">\n <Switch id={toggleId} checked={on} disabled={disabled || locked} aria-label={`${on ? 'Turn off' : 'Turn on'} ${name}`}\n title={lockReason} onCheckedChange={checked => toggle(name, server, checked)} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-3\">\n <label htmlFor={toggleId} className={`min-w-0 break-words ${formText.label}`}>{name}</label>\n <StatusPill tone={status.tone}>{status.label}</StatusPill>\n </div>\n <p className={`truncate ${formText.muted}`} title={target || undefined}>{target || 'No address yet'}</p>\n {description && <p className={formText.muted}>{description}</p>}\n {policyProblem && <p className={formText.error}>{policyProblem}</p>}\n {on && !local && result && result !== 'checking' && !result.ok && result.problem !== 'not-checkable' &&\n <p className={result.problem === 'auth-required' || result.problem === 'unavailable' ? formText.muted : formText.error}>{result.message}</p>}\n {on && result && result !== 'checking' && result.ok && result.tools.length > 0 &&\n <p className={`line-clamp-2 ${formText.muted}`}>Tools: {result.tools.map(tool => tool.name).join(', ')}</p>}\n </div>\n </div>\n {!locked && <div className=\"flex flex-wrap gap-1 pl-9\">\n {port && on && !local && <Button type=\"button\" size=\"compact\" variant=\"ghost\" disabled={disabled || result === 'checking'}\n onClick={() => setRecheck(current => ({ ...current, [name]: (current[name] ?? 0) + 1 }))}>Check again</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" disabled={disabled} aria-label={`Edit ${name}`}\n onClick={() => setEditing({ name, draft: { name, transport: serverTransport(config), target } })}>Edit</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={disabled}\n aria-label={`Remove ${name}`} onClick={() => { if (setServer(name, null) && editing?.name === name) setEditing(null) }}>Remove</Button>\n </div>}\n {editing?.name === name && <div className=\"space-y-2 @lg/profile-editor:pl-12\">\n {editing.reason && <p className={formText.muted}>{editing.reason}</p>}\n <ServerForm draft={editing.draft} onDraft={draft => setEditing({ ...editing, draft })} existingNames={[]} nameEditable={false}\n publicHttpsOnly={publicHttpsOnly} allowLocalCommand={allowLocalCommand} disabled={disabled} submitLabel=\"Save\"\n onCancel={() => setEditing(null)}\n onSubmit={() => { if (setServer(name, serverFromDraft(editing.draft, server))) setEditing(null) }} />\n </div>}\n </li>\n })}\n </ul>}\n {locked && <p className={formText.muted}>{lockReason}</p>}\n {!locked && (adding\n ? <ServerForm draft={adding} onDraft={setAdding} existingNames={Object.keys(servers)} nameEditable publicHttpsOnly={publicHttpsOnly}\n allowLocalCommand={allowLocalCommand} disabled={disabled} submitLabel=\"Add server\" onCancel={() => setAdding(null)}\n onSubmit={() => { if (setServer(adding.name.trim(), serverFromDraft(adding))) setAdding(null) }} />\n : <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={disabled} onClick={() => setAdding({ name: '', transport: 'http', target: '' })}>Add server</Button>)}\n {registry && !locked && <AgentProfileRegistryMcpSearch registry={registry} disabled={disabled} existingNames={Object.keys(servers)}\n validate={(name, server) => {\n if (!name.trim()) return 'The registry returned a server without a usable name.'\n if (name in servers) return 'A server with that name already exists.'\n return publicHttpsOnly && 'url' in server && server.url ? publicHttpsUrlProblem(server.url)\n : publicHttpsOnly ? 'Use a public HTTPS MCP endpoint.' : null\n }}\n onAdd={(name, server) => setServer(name, server)} />}\n <p className={formText.muted}>Headers, environment variables, and secret references are edited in Advanced JSON.</p>\n </div>\n}\n","/**\n * Drop or choose text files to add to the profile as resource files. Each file\n * is read in the browser and stored inline, with per-file progress and a clear\n * reason for any file that is refused (type, size, count, encoding, or a path\n * already in use). The drop target and the progress list are the shared\n * `SidebarDropZone` and `UploadProgress` primitives.\n */\nimport { useRef, useState, type ReactNode } from 'react'\nimport { Button } from '@tangle-network/sandbox-ui/primitives'\nimport { SidebarDropZone, UploadProgress, type UploadFile } from '@tangle-network/ui/primitives'\nimport { filterAcceptedFiles } from './composer-file-accept'\nimport { formText } from './agent-profile-form-kit'\n\nexport interface ResourceFileLimits {\n /** Accepted types, in `<input accept>` grammar. Defaults to Markdown, text, and JSON. */\n accept?: readonly string[]\n /** Largest file in bytes. Defaults to 256 KiB. */\n maxFileBytes?: number\n /** Most resource files in the profile. Defaults to 50. */\n maxFiles?: number\n}\n\nconst DEFAULT_RESOURCE_FILE_ACCEPT = ['.md', '.markdown', '.txt', '.json', '.yaml', '.yml', '.csv'] as const\n\ninterface ReadFile {\n name: string\n content: string\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`\n if (bytes < 1024 * 1024) return `${Math.max(1, Math.round(bytes / 1024))} KB`\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\n/** A file name safe to use as one path segment. */\nfunction safeFileName(name: string): string {\n const base = name.split(/[\\\\/]/).pop() ?? name\n return base.normalize('NFKC').replace(/[\\u0000-\\u001f\\u007f]/g, '').replace(/\\s+/g, '-').replace(/[^A-Za-z0-9._-]/g, '').replace(/^\\.+/, '') || 'file'\n}\n\nfunction readText(file: File, onProgress: (percent: number) => void): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onprogress = event => { if (event.lengthComputable) onProgress(Math.round((event.loaded / event.total) * 100)) }\n reader.onerror = () => reject(new Error('The browser could not read this file.'))\n reader.onload = () => {\n const buffer = reader.result\n if (!(buffer instanceof ArrayBuffer)) { reject(new Error('The browser could not read this file.')); return }\n try { resolve(new TextDecoder('utf-8', { fatal: true }).decode(buffer)) } catch {\n reject(new Error('This is not a text file. Upload UTF-8 text, Markdown, or JSON.'))\n }\n }\n reader.readAsArrayBuffer(file)\n })\n}\n\nexport interface ResourceFileDropProps {\n /** Paths already in the profile, for conflict checks. */\n existingPaths: readonly string[]\n /** Folder new files land in, for example `reference/`. */\n pathPrefix?: string\n limits?: ResourceFileLimits\n disabled?: boolean\n /** Add the read files. Returns the reason the profile rejected them, or null. */\n onAdd: (files: { path: string; file: ReadFile }[]) => string | null\n /** More add actions shown beside \"Choose files\". */\n actions?: ReactNode\n}\n\n/** The drop target, file chooser, and progress list for resource files. */\nexport function ResourceFileDrop({ existingPaths, pathPrefix = '', limits, disabled = false, onAdd, actions }: ResourceFileDropProps) {\n const [uploads, setUploads] = useState<UploadFile[]>([])\n const input = useRef<HTMLInputElement>(null)\n const accept = (limits?.accept ?? DEFAULT_RESOURCE_FILE_ACCEPT).join(',')\n const maxFileBytes = limits?.maxFileBytes ?? 256 * 1024\n const maxFiles = limits?.maxFiles ?? 50\n const types = (limits?.accept ?? DEFAULT_RESOURCE_FILE_ACCEPT).map(type => type.replace(/^\\./, '').toUpperCase())\n const typeList = types.length > 1 ? `${types.slice(0, -1).join(', ')} or ${types[types.length - 1]}` : types[0]\n\n function update(id: string, change: Partial<UploadFile>) {\n setUploads(current => current.map(item => item.id === id ? { ...item, ...change } : item))\n }\n\n async function receive(list: File[] | FileList) {\n if (disabled) return\n const files = Array.from(list)\n if (!files.length) return\n const { rejected } = filterAcceptedFiles(files, accept)\n const batch: UploadFile[] = []\n const taken = new Set(existingPaths)\n let room = maxFiles - existingPaths.length\n const work: { id: string; file: File; path: string }[] = []\n for (const file of files) {\n const id = `${Date.now()}-${Math.random().toString(36).slice(2)}`\n const base: UploadFile = { id, name: file.name, size: file.size, status: 'pending' }\n const path = pathPrefix + safeFileName(file.name)\n let error: string | null = null\n if (rejected.some(item => item.file === file)) error = `Only ${typeList} files can be added.`\n else if (file.size > maxFileBytes) error = `This file is ${formatBytes(file.size)}. Files can be up to ${formatBytes(maxFileBytes)}.`\n else if (file.size === 0) error = 'This file is empty.'\n else if (taken.has(path)) error = `${path} is already in the profile. Remove it first or rename the file.`\n else if (room <= 0) error = `The profile can hold ${maxFiles} files. Remove one to add another.`\n if (error) { batch.push({ ...base, status: 'error', error }); continue }\n taken.add(path)\n room--\n batch.push(base)\n work.push({ id, file, path })\n }\n setUploads(current => [...current.filter(item => item.status !== 'complete'), ...batch])\n const read: { id: string; path: string; file: ReadFile }[] = []\n for (const item of work) {\n update(item.id, { status: 'uploading', progress: 0 })\n try {\n const content = await readText(item.file, progress => update(item.id, { progress }))\n read.push({ id: item.id, path: item.path, file: { name: safeFileName(item.file.name), content } })\n update(item.id, { progress: 100 })\n } catch (cause) {\n update(item.id, { status: 'error', error: cause instanceof Error ? cause.message : 'The file could not be read.' })\n }\n }\n if (!read.length) return\n const refused = onAdd(read.map(({ path, file }) => ({ path, file })))\n for (const item of read) {\n update(item.id, refused ? { status: 'error', error: refused } : { status: 'complete', progress: 100 })\n }\n }\n\n return <div className=\"space-y-3\">\n <SidebarDropZone persistent disabled={disabled} onDrop={files => void receive(files)}\n title=\"Drop files here\"\n description={`${typeList} up to ${formatBytes(maxFileBytes)} each`}\n // The primitive's own copy is 12px and 10px; the form uses one 14px size.\n className=\"[&_p]:text-sm [&_p]:leading-6 focus-within:border-[var(--focus-border)]\" />\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={disabled} onClick={() => input.current?.click()}>Choose files</Button>\n {actions}\n <input ref={input} type=\"file\" multiple accept={accept} className=\"sr-only\" tabIndex={-1} aria-hidden=\"true\"\n onChange={event => { const files = event.target.files; if (files) void receive(files); event.target.value = '' }} />\n {uploads.length > 0 && <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={() => setUploads([])}>Clear list</Button>}\n </div>\n {uploads.length > 0 && <div aria-live=\"polite\">\n <UploadProgress files={uploads} onRemove={id => setUploads(current => current.filter(item => item.id !== id))}\n // The primitive sets size and error text at 12px; keep them at the form's 14px.\n className=\"[&_.text-xs]:text-sm\" />\n </div>}\n {uploads.some(item => item.status === 'error') && <p className={formText.muted}>Files with an error were not added.</p>}\n </div>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAAA,YAAW,SAAAC,QAAO,WAAAC,UAAS,YAAAC,iBAAgC;AAEpE,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,S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AAA,MAAO,aAAa,SAAS;AAAA,MAAa,GAAG;AAAA,MAC9G,gBAAc,QAAQ,OAAO;AAAA,MAAW,oBAAkB,eAAe,EAAE;AAAA,MAAG,UAAU,WAAS,SAAS,MAAM,OAAO,KAAK;AAAA;AAAA,EAAG,GACnI;AACF;","names":["useEffect","useId","useMemo","useState","Button","Input","Switch","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","useState","jsx","jsxs","useEffect","useId","useRef","useState","Button","Input","useId","useRef","useState","Input","jsx","jsxs","useState","useRef","useId","Input","Fragment","jsx","jsxs","useState","useRef","useEffect","useId","Button","Input","useEffect","useId","useMemo","useRef","useState","Button","Input","jsx","jsxs","useId","Input","Button","useState","useRef","useMemo","useEffect","useRef","useState","Button","jsx","jsxs","useState","useRef","Button","Fragment","jsx","jsxs","useId","useState","useEffect","useMemo","Input","Switch","Button","rowActions","Select","SelectTrigger","SelectValue","SelectContent","SelectItem"]}
|
|
@@ -35,6 +35,14 @@ export interface AgentProfileEditorConfig {
|
|
|
35
35
|
/** False when the product fixes the profile name. Defaults to true. */
|
|
36
36
|
nameEditable?: boolean;
|
|
37
37
|
};
|
|
38
|
+
/** Hide prompt controls that the host does not persist or execute. Omitted controls remain enabled. */
|
|
39
|
+
prompts?: {
|
|
40
|
+
appendSystemPrompt?: boolean;
|
|
41
|
+
systemPrompt?: boolean;
|
|
42
|
+
instructions?: boolean;
|
|
43
|
+
};
|
|
44
|
+
/** Keep hidden resources opaque when the host preserves and validates their authority on save. Defaults to false. */
|
|
45
|
+
preserveHiddenResources?: boolean;
|
|
38
46
|
/** Catalog-backed model selectors. Without it, model fields are plain text inputs. */
|
|
39
47
|
models?: AgentProfileEditorModelCatalog;
|
|
40
48
|
/** Harnesses the product runs. Omit to hide the harness selector. */
|
package/dist/web-react/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/web-react/agent-profile-editor.tsx","../src/web-react/agent-profile-registry-search.tsx","../src/web-react/agent-profile-registry.ts","../src/web-react/agent-profile-form-kit.tsx","../src/web-react/agent-profile-github-source.tsx","../src/web-react/agent-profile-suggest-input.tsx","../src/web-react/agent-profile-mcp-servers.tsx","../src/web-react/agent-profile-files.tsx"],"sourcesContent":["import { useEffect, useId, useMemo, useState, type ReactNode } from 'react'\nimport type { AgentProfile, AgentProfileFileMount, AgentProfileResourceRef } from '@tangle-network/agent-interface/profile'\nimport { REASONING_EFFORTS } from '@tangle-network/agent-interface/profile'\nimport { reasoningEffortsFor } from '@tangle-network/agent-interface/harness-capabilities'\nimport { agentProfileSchema } from '@tangle-network/agent-interface/profile-schema'\nimport { Button, Input, Textarea, Switch, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@tangle-network/sandbox-ui/primitives'\nimport { TooltipProvider } from '@tangle-network/ui/primitives'\nimport { isModelCompatibleWithHarness, snapModelToHarness, type Harness } from '../harness'\nimport type { CatalogModel } from '../runtime/model-catalog'\nimport { publicHttpsUrlProblem, readSkillFrontmatter, type GitHubSourceCheck, type ProfileEditorGitHubPort, type ProfileEditorMcpPort } from '../profile-editor'\nimport { EffortPicker, effortLevelsFromIds, ModelPicker, type EffortLevel } from './controls'\nimport { HarnessPicker } from './agent-session-controls'\nimport type { AgentProfileRegistryPort } from './agent-profile-registry'\nimport { AgentProfileRegistrySkillSearch } from './agent-profile-registry-search'\nimport { Field, fieldMessageId, formRow, formText, listRow, noAutofill, Notice, rowActions as rowActionsClass, Section, StatusLine } from './agent-profile-form-kit'\nimport { GitHubSourcePicker } from './agent-profile-github-source'\nimport { McpServersEditor } from './agent-profile-mcp-servers'\nimport { ResourceFileDrop, type ResourceFileLimits } from './agent-profile-files'\n\nexport type AgentProfileResourceKind = 'files' | 'skills' | 'tools' | 'agents' | 'commands' | 'instructions'\n\n/** Editor sections a product can offer, in display order. */\nexport type AgentProfileEditorSection = 'identity' | 'prompts' | 'model' | 'tools' | 'skills' | 'toolFiles' | 'mcp' | 'files' | 'advanced'\n\nexport const AGENT_PROFILE_EDITOR_SECTIONS: readonly AgentProfileEditorSection[] =\n ['identity', 'prompts', 'model', 'tools', 'skills', 'toolFiles', 'mcp', 'files', 'advanced']\n\nexport interface AgentProfileEditorSaveState {\n /** Internal JSON, resource, or tool edits have not been applied to the profile. */\n pending: boolean\n /** Validation failed or stored values violate this editor's constraints. */\n invalid: boolean\n}\n\n/** The model catalog the selectors offer: the same list the product's chat composer uses. */\nexport interface AgentProfileEditorModelCatalog {\n models: CatalogModel[]\n loading?: boolean\n error?: string | null\n onRetry?: () => void\n /** Label for an empty model setting, for example \"Product default\". */\n defaultLabel?: string\n}\n\n/**\n * What a product offers in the editor. Every part is optional; an omitted part\n * falls back to the plain control or hides the section.\n */\nexport interface AgentProfileEditorConfig {\n /** Sections to show, in the editor's fixed order. Defaults to every section the other props allow. */\n sections?: readonly AgentProfileEditorSection[]\n identity?: {\n /** False when the product fixes the profile name. Defaults to true. */\n nameEditable?: boolean\n }\n /** Catalog-backed model selectors. Without it, model fields are plain text inputs. */\n models?: AgentProfileEditorModelCatalog\n /** Harnesses the product runs. Omit to hide the harness selector. */\n harnesses?: readonly Harness[]\n /** Thinking levels for a harness and model. Defaults to the levels that harness applies, plus Auto. */\n thinkingLevels?: (input: { harness?: Harness; model?: CatalogModel }) => readonly EffortLevel[]\n /** GitHub sources through the product's checks. Without it, GitHub sources are typed by hand. */\n github?: {\n port: ProfileEditorGitHubPort\n /**\n * `reference` stores `{ kind: 'github', repository, path, ref }` pinned to the\n * checked commit. `inline` stores the checked file's text, for products that\n * do not fetch GitHub at run time.\n */\n storage: 'reference' | 'inline'\n /** Where the person connects GitHub, shown when the workspace has no connection. */\n connectHref?: string\n }\n mcp?: {\n /** Health checks; each enabled remote server is checked automatically. */\n port?: ProfileEditorMcpPort\n /** Explain why servers are read-only here. Presence locks toggles and edits. */\n lockReason?: string\n /** Offer local command servers. Defaults to true unless `publicHttpsMcpOnly` is set. */\n allowLocalCommand?: boolean\n }\n /** Limits for uploaded resource files. */\n files?: ResourceFileLimits\n}\n\nexport interface AgentProfileEditorProps {\n value: AgentProfile\n onChange: (value: AgentProfile) => void\n /** Disable the host's save action while edits are pending or invalid. */\n onSaveStateChange?: (state: AgentProfileEditorSaveState) => void\n disabled?: boolean\n className?: string\n /** Product configuration: sections, model catalog, harnesses, and source checks. */\n config?: AgentProfileEditorConfig\n /** Hide unsupported resource controls. Existing entries remain in the profile and are flagged for review. */\n allowedResourceKinds?: readonly AgentProfileResourceKind[]\n /** Require resource file workspace paths under this relative folder, for example `reference/`. */\n filePathPrefix?: string\n /** Disable new executable resource files while retaining existing values for review. Defaults to true. */\n allowExecutableFiles?: boolean\n /** Require a 40-character commit SHA for GitHub resource refs. Defaults to false. */\n requireGitHubCommitSha?: boolean\n /** Require unique skill names matching `[a-z0-9][a-z0-9._-]{0,63}`. Defaults to false. */\n requireUniqueSkillNames?: boolean\n /** Hide the generic tool and permission controls without removing stored values. Defaults to true. */\n showToolsAndPermissions?: boolean\n /** Offer only public HTTPS MCP endpoints while retaining existing servers for review. Defaults to false. */\n publicHttpsMcpOnly?: boolean\n /** Host-supplied registry discovery (agent-app#776). Omit to hide catalog search entirely. */\n registry?: AgentProfileRegistryPort\n}\n\nconst RESOURCE_KIND_LABELS: Record<AgentProfileResourceKind, string> = {\n files: 'Resource files', skills: 'Skills', tools: 'Tool files',\n agents: 'Agent files', commands: 'Command files', instructions: 'Resource instructions',\n}\n\nfunction configuredResourceCount(profile: AgentProfile, kind: AgentProfileResourceKind): number {\n const resource = profile.resources?.[kind]\n return Array.isArray(resource) ? resource.length : resource ? 1 : 0\n}\n\nfunction issueMessage(error: { issues: readonly { path: PropertyKey[]; message: string }[] }) {\n const issue = error.issues[0]\n return issue ? (issue.path.map(String).join('.') || 'Profile') + ': ' + issue.message : 'Invalid profile'\n}\n\nfunction validRelativePath(path: string): boolean {\n return path.length <= 240 && !path.startsWith('/') && !path.includes('\\\\') &&\n !/[\\u0000-\\u001f\\u007f]/.test(path) && path.split('/').every(segment => segment !== '' && segment !== '.' && segment !== '..')\n}\n\nfunction normalizedFilePathPrefix(prefix?: string): string | undefined {\n const folder = prefix?.trim().replace(/\\/+$/, '')\n return folder ? folder + '/' : undefined\n}\n\nconst SKILL_NAME = /^[a-z0-9][a-z0-9._-]{0,63}$/\n\n/** Problems with a stored or drafted GitHub reference under the product's constraints. */\nfunction githubRefIssue(ref: AgentProfileResourceRef, requireGitHubCommitSha: boolean): string | null {\n if (ref.kind !== 'github') return null\n const repository = ref.repository ?? ''\n if (!/^[A-Za-z0-9_.-]+\\/[A-Za-z0-9_.-]+$/.test(repository) || repository.split('/').some(part => part === '.' || part === '..')) {\n return 'Choose the GitHub repository for this file.'\n }\n if (!ref.path) return 'Choose a file in the repository.'\n if (requireGitHubCommitSha) {\n if (!/^[0-9a-f]{40}$/i.test(ref.ref ?? '')) return 'Pin this source to a 40-character GitHub commit SHA.'\n if (!validRelativePath(ref.path) || /[?#%]/.test(ref.path)) return 'Use a relative repository path without traversal or URL characters.'\n }\n return null\n}\n\nfunction inlineSkillSummary(content: string): string | null {\n const frontmatter = readSkillFrontmatter(content)\n if (frontmatter.ok) return frontmatter.description\n const line = content.split('\\n').map(text => text.replace(/^#+\\s*/, '').trim()).find(Boolean)\n return line ? line.slice(0, 160) : null\n}\n\nfunction sourceLine(ref: AgentProfileResourceRef): string {\n if (ref.kind === 'inline') return `Written here · ${Math.max(1, Math.round(new TextEncoder().encode(ref.content).byteLength / 1024))} KB`\n return ['GitHub', ref.repository ? `${ref.repository}/${ref.path}` : ref.path, ref.ref ? `@ ${ref.ref.slice(0, 7)}` : null].filter(Boolean).join(' · ')\n}\n\nfunction basename(path: string): string {\n return path.split('/').filter(Boolean).pop() ?? path\n}\n\n/** A suggested skill name from frontmatter or the skill folder. */\nfunction suggestedSkillName(check: GitHubSourceCheck): string {\n const fromFrontmatter = check.skill?.name ?? ''\n const folder = check.path.split('/').slice(-2, -1)[0] ?? ''\n const raw = fromFrontmatter || folder || basename(check.path).replace(/\\.md$/i, '')\n return raw.toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^[^a-z0-9]+/, '').slice(0, 64)\n}\n\nfunction defaultThinkingLevels({ harness, model }: { harness?: Harness; model?: CatalogModel }): readonly EffortLevel[] {\n const efforts = harness ? reasoningEffortsFor(harness, { supportsReasoning: model?.supportsReasoning !== false }) : REASONING_EFFORTS\n return [{ id: 'auto', label: 'Auto' }, ...effortLevelsFromIds(efforts)]\n}\n\ntype Panel =\n | { kind: 'add-github' | 'add-inline'; section: 'skills' | 'tools' | 'files' }\n | { kind: 'edit'; section: 'skills' | 'tools' | 'files'; index: number }\n\ninterface InlineDraft { name: string; content: string; path: string; executable: boolean }\n\n/** Controlled editor for the canonical profile. The product owns save and execution authority. */\nexport function AgentProfileEditor({ value, onChange, disabled = false, className, config, allowedResourceKinds,\n filePathPrefix, allowExecutableFiles = true, requireGitHubCommitSha = false, requireUniqueSkillNames = false,\n showToolsAndPermissions = true, publicHttpsMcpOnly = false, registry, onSaveStateChange }: AgentProfileEditorProps) {\n const id = useId()\n const workspaceFilePrefix = normalizedFilePathPrefix(filePathPrefix)\n const [error, setError] = useState<string | null>(null)\n const [newTool, setNewTool] = useState('')\n const [showAllTools, setShowAllTools] = useState(false)\n const [panel, setPanel] = useState<Panel | null>(null)\n const [inlineDraft, setInlineDraft] = useState<InlineDraft>({ name: '', content: '', path: '', executable: false })\n const [githubName, setGithubName] = useState<{ value: string; touched: boolean }>({ value: '', touched: false })\n const [mcpPending, setMcpPending] = useState(false)\n const [modelNotice, setModelNotice] = useState<string | null>(null)\n const [json, setJson] = useState(() => JSON.stringify(value, null, 2))\n const [jsonDirty, setJsonDirty] = useState(false)\n useEffect(() => { if (!jsonDirty) setJson(JSON.stringify(value, null, 2)) }, [value, jsonDirty])\n const editingDisabled = disabled || jsonDirty\n // More instructions holds the replacement prompt and project instructions; it is open whenever\n // either has content, including content that arrives after the first render.\n const hasMorePrompt = Boolean(value.prompt?.systemPrompt || value.prompt?.instructions?.length)\n const [moreOpen, setMoreOpen] = useState(hasMorePrompt)\n useEffect(() => { if (hasMorePrompt) setMoreOpen(true) }, [hasMorePrompt])\n\n const sectionAllowed = (section: AgentProfileEditorSection) => !config?.sections || config.sections.includes(section)\n const allowsResource = (kind: AgentProfileResourceKind) => !allowedResourceKinds || allowedResourceKinds.includes(kind)\n const show = {\n identity: sectionAllowed('identity'),\n prompts: sectionAllowed('prompts'),\n model: sectionAllowed('model'),\n tools: sectionAllowed('tools') && showToolsAndPermissions,\n skills: sectionAllowed('skills') && allowsResource('skills'),\n toolFiles: sectionAllowed('toolFiles') && allowsResource('tools'),\n mcp: sectionAllowed('mcp'),\n files: sectionAllowed('files') && allowsResource('files'),\n advanced: sectionAllowed('advanced'),\n }\n const unsupportedResources = (Object.keys(RESOURCE_KIND_LABELS) as AgentProfileResourceKind[])\n .filter(kind => configuredResourceCount(value, kind) > 0 && !(\n (kind === 'skills' && show.skills) || (kind === 'tools' && show.toolFiles) || (kind === 'files' && show.files) ||\n (allowsResource(kind) && kind !== 'skills' && kind !== 'tools' && kind !== 'files')))\n const skills = value.resources?.skills ?? []\n const toolFiles = value.resources?.tools ?? []\n const files = value.resources?.files ?? []\n const instructions = value.resources?.instructions\n\n function skillIssue(ref: AgentProfileResourceRef, refs: readonly AgentProfileResourceRef[], index?: number): string | null {\n if (requireUniqueSkillNames) {\n const name = ref.name ?? ''\n if (!SKILL_NAME.test(name)) return 'Use a lowercase name of up to 64 letters, numbers, dots, dashes, or underscores.'\n if (refs.some((other, item) => item !== index && other.name === name)) return 'Another skill already uses this name.'\n }\n if (ref.kind === 'inline' && !ref.name.trim()) return 'Name this skill.'\n return githubRefIssue(ref, requireGitHubCommitSha)\n }\n function fileIssue(mount: AgentProfileFileMount, index?: number): string | null {\n const path = mount.path\n if (!path.trim()) return 'Enter a workspace path for the file.'\n if (!validRelativePath(path)) return 'Use a relative workspace path without traversal.'\n if (workspaceFilePrefix && !path.startsWith(workspaceFilePrefix)) return `Place this file under ${workspaceFilePrefix}.`\n if (files.some((other, item) => item !== index && other.path === path)) return 'Another file already uses this path.'\n if (!allowExecutableFiles && mount.executable) return 'Executable files are not allowed in this product.'\n if (mount.resource.kind === 'inline' && !mount.resource.name.trim()) return 'Name this file.'\n return githubRefIssue(mount.resource, requireGitHubCommitSha)\n }\n const constrainedEntryCount = workspaceFilePrefix || !allowExecutableFiles || requireGitHubCommitSha || requireUniqueSkillNames\n ? files.filter((mount, index) => fileIssue(mount, index)).length +\n skills.filter((ref, index) => skillIssue(ref, skills, index)).length +\n toolFiles.filter(ref => requireGitHubCommitSha && githubRefIssue(ref, true)).length +\n Number(Boolean(requireGitHubCommitSha && instructions && typeof instructions === 'object' && githubRefIssue(instructions, true)))\n : 0\n const invalidMcpCount = publicHttpsMcpOnly\n ? Object.values(value.mcp ?? {}).filter(server => server.enabled !== false &&\n (!('url' in server) || !server.url || publicHttpsUrlProblem(server.url) !== null)).length : 0\n\n const pending = jsonDirty || panel !== null || mcpPending || Boolean(newTool.trim())\n const invalid = Boolean(error || unsupportedResources.length || constrainedEntryCount || invalidMcpCount)\n useEffect(() => { onSaveStateChange?.({ pending, invalid }) }, [onSaveStateChange, pending, invalid])\n useEffect(() => () => { onSaveStateChange?.({ pending: false, invalid: false }) }, [onSaveStateChange])\n\n function emit(next: AgentProfile) {\n if (jsonDirty) { setError('Apply or discard JSON edits first.'); return false }\n const result = agentProfileSchema.safeParse(next)\n if (!result.success) { setError(issueMessage(result.error)); return false }\n setError(null)\n onChange(result.data)\n return true\n }\n // An emptied prompt box removes its key: an empty replacement or appended prompt is not a prompt,\n // and runtimes refuse it rather than guess whether it means \"none\" or \"keep the built-in prompt\".\n function prompt(next: NonNullable<AgentProfile['prompt']>) {\n const cleaned = { ...next }\n if (cleaned.systemPrompt === '') delete cleaned.systemPrompt\n if (cleaned.appendSystemPrompt === '') delete cleaned.appendSystemPrompt\n const { prompt: _prompt, ...rest } = value\n emit(Object.values(cleaned).some(item => item !== undefined) ? { ...rest, prompt: cleaned } : rest)\n }\n function model(next: NonNullable<AgentProfile['model']>) {\n const cleaned = Object.fromEntries(Object.entries(next).filter(([, item]) => item !== undefined && item !== '')) as NonNullable<AgentProfile['model']>\n const { model: _model, ...rest } = value\n emit(Object.keys(cleaned).length ? { ...rest, model: cleaned } : rest)\n }\n function resources(key: 'skills' | 'tools', refs: AgentProfileResourceRef[]) {\n return emit({ ...value, resources: { ...value.resources, [key]: refs } })\n }\n function setFiles(next: AgentProfileFileMount[]) {\n return emit({ ...value, resources: { ...value.resources, files: next } })\n }\n function openPanel(next: Panel | null) {\n setPanel(next)\n setError(null)\n setGithubName({ value: '', touched: false })\n if (next?.kind === 'edit') {\n const ref = next.section === 'files' ? files[next.index]?.resource : (next.section === 'skills' ? skills : toolFiles)[next.index]\n const mount = next.section === 'files' ? files[next.index] : undefined\n setInlineDraft({ name: ref?.kind === 'inline' ? ref.name : ref?.name ?? '', content: ref?.kind === 'inline' ? ref.content : '',\n path: mount?.path ?? '', executable: mount?.executable ?? false })\n } else {\n setInlineDraft({ name: '', content: '', path: next?.section === 'files' ? workspaceFilePrefix ?? '' : '', executable: false })\n }\n }\n function applyJson() {\n try {\n const result = agentProfileSchema.safeParse(JSON.parse(json))\n if (!result.success) { setError(issueMessage(result.error)); return }\n setError(null)\n setJsonDirty(false)\n onChange(result.data)\n } catch (cause) { setError(cause instanceof Error ? cause.message : 'Invalid JSON') }\n }\n\n // ── Model and runtime ─────────────────────────────────────────────────────\n const catalog = config?.models\n // The stored harness, even when the product's list omits it, so the selector reports what will run.\n const harness = value.harness as Harness | undefined\n const offeredModels = useMemo(() => !catalog ? [] : harness\n ? catalog.models.filter(item => isModelCompatibleWithHarness(harness, item.id))\n : catalog.models, [catalog, harness])\n const selectedModel = catalog?.models.find(item => item.id === value.model?.default)\n const thinkingLevels = (config?.thinkingLevels ?? defaultThinkingLevels)({ harness, model: selectedModel })\n function changeHarness(next: Harness | '') {\n setModelNotice(null)\n const { harness: _harness, ...rest } = value\n let nextModel = value.model\n if (next && catalog && value.model?.default && !isModelCompatibleWithHarness(next, value.model.default)) {\n const ids = catalog.models.map(item => item.id)\n const snapped = snapModelToHarness(next, value.model.default, ids)\n if (snapped !== value.model.default) {\n nextModel = { ...value.model, default: snapped }\n const name = catalog.models.find(item => item.id === snapped)?.name ?? snapped\n setModelNotice(`Default model changed to ${name}, which runs on this harness.`)\n }\n }\n emit({ ...rest, ...(next ? { harness: next } : {}), ...(nextModel ? { model: nextModel } : {}) })\n }\n function modelField(label: string, field: 'default' | 'small', info: ReactNode) {\n const fieldId = `${id}-model-${field}`\n const current = value.model?.[field] ?? ''\n return <Field label={label} htmlFor={fieldId} info={info}>\n {catalog\n ? <ModelPicker id={fieldId} variant=\"field\" value={current} onChange={next => model({ ...value.model, [field]: next || undefined })}\n models={offeredModels} loading={catalog.loading} error={catalog.error} onRetry={catalog.onRetry} disabled={editingDisabled}\n defaultOption={{ label: catalog.defaultLabel ?? 'Product default' }} />\n : <Input id={fieldId} size=\"compact\" value={current} disabled={editingDisabled} placeholder=\"provider/model\" {...noAutofill}\n onChange={event => model({ ...value.model, [field]: event.target.value || undefined })} />}\n </Field>\n }\n\n // ── Resource rows and panels ─────────────────────────────────────────────\n const github = config?.github\n function refFromCheck(check: GitHubSourceCheck, name: string): AgentProfileResourceRef {\n return github?.storage === 'inline'\n ? { kind: 'inline', name, content: check.content }\n : { kind: 'github', repository: check.repository, path: check.path, ref: check.commit.sha, ...(name ? { name } : {}) }\n }\n function addRef(section: 'skills' | 'tools', ref: AgentProfileResourceRef, index?: number): boolean {\n const refs = section === 'skills' ? skills : toolFiles\n const issue = section === 'skills' ? skillIssue(ref, refs, index ?? refs.length) : githubRefIssue(ref, requireGitHubCommitSha)\n if (issue) { setError(issue); return false }\n const next = index === undefined ? [...refs, ref] : refs.map((item, position) => position === index ? ref : item)\n return resources(section, next)\n }\n function addFile(mount: AgentProfileFileMount, index?: number): boolean {\n const issue = fileIssue(mount, index ?? files.length)\n if (issue) { setError(issue); return false }\n return setFiles(index === undefined ? [...files, mount] : files.map((item, position) => position === index ? mount : item))\n }\n\n function nameField(check: GitHubSourceCheck | null, section: 'skills' | 'tools') {\n const fieldId = `${id}-${section}-github-name`\n const suggested = check ? (section === 'skills' ? suggestedSkillName(check) : basename(check.path)) : ''\n const name = githubName.touched ? githubName.value : suggested\n const problem = section === 'skills' && requireUniqueSkillNames && name\n ? skillIssue({ kind: 'inline', name, content: '' }, skills) : null\n return <Field label={section === 'skills' ? 'Skill name' : 'File name'} htmlFor={fieldId} error={problem}\n hint={section === 'skills' && !problem ? 'Shown to the agent in its skill list.' : undefined}>\n <Input id={fieldId} size=\"compact\" value={name} disabled={editingDisabled || !check} {...noAutofill}\n aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(fieldId)}\n onChange={event => setGithubName({ value: event.target.value, touched: true })} />\n </Field>\n }\n function githubNameValue(check: GitHubSourceCheck, section: 'skills' | 'tools'): string {\n return (githubName.touched ? githubName.value : section === 'skills' ? suggestedSkillName(check) : basename(check.path)).trim()\n }\n\n function inlineEditor(section: 'skills' | 'tools' | 'files', index?: number) {\n const prefix = `${id}-${section}-inline`\n const isSkill = section === 'skills'\n const isFile = section === 'files'\n const name = inlineDraft.name.trim()\n const frontmatter = isSkill && inlineDraft.content.trim() ? readSkillFrontmatter(inlineDraft.content) : null\n const mount: AgentProfileFileMount | null = isFile ? { path: inlineDraft.path.trim(),\n resource: { kind: 'inline', name: name || basename(inlineDraft.path.trim()), content: inlineDraft.content },\n ...(inlineDraft.executable ? { executable: true } : {}) } : null\n const problem = isFile ? (inlineDraft.path.trim() ? fileIssue(mount!, index ?? files.length) : null)\n : isSkill && name ? skillIssue({ kind: 'inline', name, content: inlineDraft.content }, skills, index ?? skills.length) : null\n const ready = !editingDisabled && !problem && (isFile ? inlineDraft.path.trim() !== '' : name !== '')\n return <div className=\"space-y-4 rounded-lg border border-border bg-muted/30 p-4\">\n {isFile\n ? <Field label=\"Workspace path\" htmlFor={`${prefix}-path`} error={problem}\n hint={!problem && workspaceFilePrefix ? `Files go under ${workspaceFilePrefix}` : undefined}>\n <Input id={`${prefix}-path`} size=\"compact\" value={inlineDraft.path} disabled={editingDisabled} {...noAutofill}\n placeholder={(workspaceFilePrefix ?? '') + 'guide.md'} aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(`${prefix}-path`)}\n onChange={event => setInlineDraft({ ...inlineDraft, path: event.target.value })} />\n </Field>\n : <Field label={isSkill ? 'Skill name' : 'File name'} htmlFor={`${prefix}-name`} error={problem}>\n <Input id={`${prefix}-name`} size=\"compact\" value={inlineDraft.name} disabled={editingDisabled} {...noAutofill}\n placeholder={isSkill ? 'research' : 'search.ts'} aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(`${prefix}-name`)}\n onChange={event => setInlineDraft({ ...inlineDraft, name: event.target.value })} />\n </Field>}\n <Field label=\"Content\" htmlFor={`${prefix}-content`}\n hint={frontmatter && !frontmatter.ok ? 'Start the skill with frontmatter that sets name and description, so the agent knows when to use it.' : undefined}>\n <Textarea id={`${prefix}-content`} className=\"min-h-40 font-mono text-sm leading-6\" disabled={editingDisabled} value={inlineDraft.content}\n onChange={event => setInlineDraft({ ...inlineDraft, content: event.target.value })} />\n </Field>\n {isFile && (allowExecutableFiles || inlineDraft.executable) && <label className={`flex items-center gap-3 ${formText.body}`}>\n <Switch disabled={editingDisabled || (!allowExecutableFiles && !inlineDraft.executable)} checked={inlineDraft.executable}\n onCheckedChange={executable => setInlineDraft({ ...inlineDraft, executable })} />Executable</label>}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" size=\"compact\" disabled={!ready} onClick={() => {\n const saved = isFile ? addFile(mount!, index)\n : addRef(section as 'skills' | 'tools', { kind: 'inline', name, content: inlineDraft.content }, index)\n if (saved) openPanel(null)\n }}>{index === undefined ? (isSkill ? 'Add skill' : 'Add file') : 'Save'}</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={() => openPanel(null)}>Cancel</Button>\n </div>\n </div>\n }\n\n function githubEditor(section: 'skills' | 'tools' | 'files', index?: number) {\n if (!github) return null\n const existing = index === undefined ? undefined\n : section === 'files' ? files[index]?.resource : (section === 'skills' ? skills : toolFiles)[index]\n const initial = existing?.kind === 'github' ? { repository: existing.repository, path: existing.path, ref: existing.ref } : undefined\n const isFile = section === 'files'\n const pathId = `${id}-${section}-github-path`\n return <div className=\"rounded-lg border border-border bg-muted/30 p-4\">\n <GitHubSourcePicker port={github.port} purpose={section === 'skills' ? 'skill' : 'file'} disabled={editingDisabled}\n connectHref={github.connectHref} initial={initial} onCancel={() => openPanel(null)}\n actionLabel={index !== undefined ? 'Save' : section === 'skills' ? 'Add skill' : 'Add file'}\n blocked={isFile && inlineDraft.path.trim() === '' ? 'Enter a workspace path.' : null}\n onChoose={({ check }) => {\n if (isFile) {\n const path = (inlineDraft.path.trim() || (workspaceFilePrefix ?? '') + basename(check.path))\n if (addFile({ path, resource: refFromCheck(check, basename(check.path)) }, index)) openPanel(null)\n return\n }\n const name = githubNameValue(check, section as 'skills' | 'tools')\n if (addRef(section as 'skills' | 'tools', refFromCheck(check, name), index)) openPanel(null)\n }}>\n {check => isFile\n ? <GitHubFilePath check={check} id={pathId} value={inlineDraft.path} prefix={workspaceFilePrefix ?? ''} disabled={editingDisabled}\n onChange={path => setInlineDraft(current => ({ ...current, path }))} issue={inlineDraft.path.trim() && check\n ? fileIssue({ path: inlineDraft.path.trim(), resource: refFromCheck(check, basename(check.path)) }, index ?? files.length) : null} />\n : nameField(check, section as 'skills' | 'tools')}\n </GitHubSourcePicker>\n </div>\n }\n\n function rowActions(label: string, section: 'skills' | 'tools' | 'files', index: number, ref: AgentProfileResourceRef) {\n const canEdit = ref.kind === 'inline' || Boolean(github)\n return <div className={rowActionsClass}>\n {canEdit && <Button type=\"button\" size=\"compact\" variant=\"ghost\" disabled={editingDisabled} aria-label={`Edit ${label}`}\n onClick={() => openPanel({ kind: 'edit', section, index })}>Edit</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={editingDisabled}\n aria-label={`Remove ${label}`} onClick={() => {\n const removed = section === 'files' ? setFiles(files.filter((_, item) => item !== index))\n : resources(section, (section === 'skills' ? skills : toolFiles).filter((_, item) => item !== index))\n if (removed && panel?.kind === 'edit' && panel.section === section) openPanel(null)\n }}>Remove</Button>\n </div>\n }\n\n function refList(section: 'skills' | 'tools', refs: readonly AgentProfileResourceRef[], noun: string) {\n if (refs.length === 0) return <p className={formText.muted}>No {noun}s yet.</p>\n return <ul className=\"divide-y divide-border rounded-lg border border-border\">{refs.map((ref, index) => {\n const title = ref.name || (ref.kind === 'github' ? basename(ref.path) : `${noun} ${index + 1}`)\n const issue = section === 'skills' ? skillIssue(ref, refs, index) : githubRefIssue(ref, requireGitHubCommitSha)\n const described = ref.kind === 'inline' && section === 'skills' ? inlineSkillSummary(ref.content) : null\n const words = (text: string) => text.toLowerCase().replace(/[-_\\s]+/g, ' ').trim()\n const summary = described && words(described) !== words(title) ? described : null\n const editing = panel?.kind === 'edit' && panel.section === section && panel.index === index\n return <li key={`${section}-${index}`} className=\"space-y-3 p-3\" aria-label={`${noun} ${title}`}>\n <div className={listRow}>\n <div className=\"min-w-0\">\n <p className={`break-words ${formText.label}`}>{title}</p>\n {summary && <p className={`line-clamp-2 ${formText.muted}`}>{summary}</p>}\n {(ref.kind === 'github' || !summary) && <p className={`break-words ${formText.muted}`}>{sourceLine(ref)}</p>}\n {issue && <p className={formText.error}>{issue}</p>}\n </div>\n {rowActions(title, section, index, ref)}\n </div>\n {editing && (ref.kind === 'github' && github ? githubEditor(section, index) : inlineEditor(section, index))}\n </li>\n })}</ul>\n }\n\n function addButtons(section: 'skills' | 'tools' | 'files', writeLabel: string) {\n if (panel && panel.kind !== 'edit' && panel.section === section) {\n return panel.kind === 'add-github' ? githubEditor(section) : inlineEditor(section)\n }\n return <div className=\"flex flex-wrap gap-2\">\n {github && <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-github', section })}>Add from GitHub</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-inline', section })}>{writeLabel}</Button>\n </div>\n }\n\n const countLabel = (count: number, noun: string) => count ? `${count} ${noun}${count === 1 ? '' : 's'}` : undefined\n const toolNames = Object.keys(value.tools ?? {})\n\n return <TooltipProvider delayDuration={150}>\n <div className={`@container/profile-editor min-w-0 space-y-4 ${className ?? ''}`} aria-label=\"Agent profile editor\">\n {error && <Notice tone=\"error\">{error}</Notice>}\n {jsonDirty && <Notice tone=\"info\">Apply or discard your Advanced JSON edits before changing other fields.</Notice>}\n {unsupportedResources.length > 0 && <Notice tone=\"error\">\n This profile has resources this product does not use: {unsupportedResources.map(kind => `${RESOURCE_KIND_LABELS[kind]} (${configuredResourceCount(value, kind)})`).join(', ')}.\n Remove them in Advanced JSON before saving.\n </Notice>}\n {constrainedEntryCount > 0 && <Notice tone=\"error\">\n {constrainedEntryCount === 1 ? 'One resource needs' : `${constrainedEntryCount} resources need`} a fix before this profile can be saved. The affected rows say what to change.\n </Notice>}\n {invalidMcpCount > 0 && <Notice tone=\"error\">\n {invalidMcpCount === 1 ? 'One MCP server needs' : `${invalidMcpCount} MCP servers need`} a public HTTPS address before this profile can be saved.\n </Notice>}\n\n {show.identity && <Section title=\"Identity\">\n <div className={formRow}>\n {config?.identity?.nameEditable !== false && <Field label=\"Name\" htmlFor={`${id}-name`}>\n <Input id={`${id}-name`} size=\"compact\" disabled={editingDisabled} value={value.name ?? ''} {...noAutofill}\n onChange={event => emit({ ...value, name: event.target.value })} />\n </Field>}\n <Field label=\"Description\" htmlFor={`${id}-description`}>\n <Input id={`${id}-description`} size=\"compact\" disabled={editingDisabled} value={value.description ?? ''} {...noAutofill}\n onChange={event => emit({ ...value, description: event.target.value })} />\n </Field>\n </div>\n </Section>}\n\n {show.prompts && <Section title=\"Instructions\" description=\"What the agent is told before every conversation.\">\n <Field label=\"Additional instructions\" htmlFor={`${id}-append`}\n info=\"Added after the agent's built-in prompt, which stays in force. Leave it empty to add nothing.\">\n <Textarea id={`${id}-append`} className=\"min-h-40 text-sm leading-6\" disabled={editingDisabled} value={value.prompt?.appendSystemPrompt ?? ''}\n onChange={event => prompt({ ...value.prompt, appendSystemPrompt: event.target.value })} />\n </Field>\n <details className=\"group/more\" open={moreOpen} onToggle={event => setMoreOpen(event.currentTarget.open)}>\n <summary className=\"flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-md text-sm font-medium text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 transition-transform group-open/more:rotate-90\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m9 6 6 6-6 6\" /></svg>\n More instructions\n </summary>\n <div className=\"mt-4 space-y-4\">\n <Field label=\"Replacement system prompt\" htmlFor={`${id}-system`}\n info=\"Replaces the agent's built-in prompt entirely. Leave it empty to keep the built-in prompt.\">\n <Textarea id={`${id}-system`} size=\"compact\" className=\"min-h-24 text-sm leading-6\" disabled={editingDisabled} value={value.prompt?.systemPrompt ?? ''}\n aria-describedby={value.prompt?.systemPrompt ? `${id}-system-replaces` : undefined}\n onChange={event => prompt({ ...value.prompt, systemPrompt: event.target.value })} />\n </Field>\n {value.prompt?.systemPrompt && <StatusLine id={`${id}-system-replaces`} tone=\"warning\">\n The built-in prompt is replaced. The agent receives this text, then the additional instructions.</StatusLine>}\n <div role=\"group\" aria-labelledby={`${id}-instructions-label`} className=\"space-y-2\">\n <div className=\"flex items-center gap-1.5\">\n <span id={`${id}-instructions-label`} className={formText.label}>Project instructions</span>\n </div>\n <p className={formText.muted}>Lower-priority guidance the agent reads like a project file.</p>\n {(value.prompt?.instructions ?? []).map((instruction, index) =>\n <div key={index} className=\"flex items-start gap-2\">\n <Textarea aria-label={`Instruction ${index + 1}`} size=\"compact\" className=\"min-h-20 text-sm leading-6\" disabled={editingDisabled} value={instruction}\n onChange={event => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).map((item, i) => i === index ? event.target.value : item) })} />\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={editingDisabled}\n aria-label={`Remove instruction ${index + 1}`}\n onClick={() => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).filter((_, i) => i !== index) })}>Remove</Button>\n </div>)}\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => prompt({ ...value.prompt, instructions: [...(value.prompt?.instructions ?? []), ''] })}>Add instruction</Button>\n </div>\n </div>\n </details>\n </Section>}\n\n {show.model && <Section title=\"Model and runtime\" description=\"Defaults for conversations and automations that do not choose their own.\">\n <div className={formRow}>\n {modelField('Default model', 'default', 'Runs when a conversation or automation does not pick a model.')}\n {config?.harnesses && config.harnesses.length > 0 && <Field label=\"Harness\" htmlFor={`${id}-harness`}\n info=\"The agent runtime that runs this profile, such as OpenCode or Codex.\">\n <HarnessPicker id={`${id}-harness`} variant=\"field\" value={harness ?? ''} onChange={changeHarness}\n available={config.harnesses} defaultOption={{ label: catalog?.defaultLabel ?? 'Product default' }} disabled={editingDisabled} />\n </Field>}\n <Field label=\"Thinking\" htmlFor={`${id}-thinking`} info=\"How hard the agent reasons before answering. Auto lets the harness decide.\">\n <EffortPicker id={`${id}-thinking`} variant=\"field\" label=\"\" value={value.model?.reasoningEffort ?? 'auto'} levels={thinkingLevels}\n disabled={editingDisabled}\n onChange={level => model({ ...value.model, reasoningEffort: level === 'auto' ? undefined : level as NonNullable<AgentProfile['model']>['reasoningEffort'] })} />\n </Field>\n {modelField('Small model', 'small', 'A faster model for short tasks such as titles and summaries.')}\n </div>\n {modelNotice && <StatusLine tone=\"neutral\">{modelNotice}</StatusLine>}\n </Section>}\n\n {show.tools && <Section title=\"Tools and permissions\" description=\"Which tools the agent may use, and when it must ask first.\"\n collapsible summary={countLabel(toolNames.length, 'rule')}>\n {toolNames.length === 0 && <p className={formText.muted}>No tool rules yet.</p>}\n {toolNames.length > 0 && <ul className=\"divide-y divide-border rounded-lg border border-border\">\n {Object.entries(value.tools ?? {}).slice(0, showAllTools ? undefined : 6).map(([name, enabled]) => {\n const switchId = `${id}-tool-${name}`\n return <li key={name} className=\"flex flex-wrap items-center gap-3 p-3\">\n <Switch id={switchId} disabled={editingDisabled} checked={enabled} aria-label={`Allow ${name}`}\n onCheckedChange={checked => emit({ ...value, tools: { ...value.tools, [name]: checked } })} />\n <label htmlFor={switchId} className={`min-w-24 flex-1 break-words ${formText.label}`}>{name}</label>\n <Select disabled={editingDisabled} value={typeof value.permissions?.[name] === 'string' ? value.permissions[name] as string : 'default'}\n onValueChange={permission => { const permissions = { ...value.permissions }; if (permission !== 'default') permissions[name] = permission as 'allow' | 'ask' | 'deny'; else delete permissions[name]; emit({ ...value, permissions }) }}>\n <SelectTrigger size=\"compact\" aria-label={`Permission for ${name}`} className=\"w-36 shadow-none\"><SelectValue /></SelectTrigger>\n <SelectContent>\n <SelectItem value=\"default\">Default</SelectItem><SelectItem value=\"allow\">Allow</SelectItem>\n <SelectItem value=\"ask\">Ask first</SelectItem><SelectItem value=\"deny\">Deny</SelectItem>\n </SelectContent>\n </Select>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={editingDisabled}\n aria-label={`Remove ${name}`} onClick={() => { const tools = { ...value.tools }; delete tools[name]; emit({ ...value, tools }) }}>Remove</Button>\n </li>\n })}\n </ul>}\n {toolNames.length > 6 && <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={() => setShowAllTools(current => !current)}>\n {showAllTools ? 'Show fewer' : `Show ${toolNames.length - 6} more`}\n </Button>}\n <div className=\"flex gap-2\">\n <Input aria-label=\"New tool name\" size=\"compact\" disabled={editingDisabled} value={newTool} placeholder=\"Tool name\" {...noAutofill}\n onChange={event => setNewTool(event.target.value)} />\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled || !newTool.trim()} onClick={() => {\n const name = newTool.trim()\n if (name in (value.tools ?? {})) { setError('A rule for this tool already exists.'); return }\n if (emit({ ...value, tools: { ...value.tools, [name]: true } })) setNewTool('')\n }}>Add tool</Button>\n </div>\n <p className={formText.muted}>Nested permission rules are edited in Advanced JSON.</p>\n </Section>}\n\n {show.skills && <Section title=\"Skills\" description=\"Instructions the agent loads when a task calls for them.\"\n collapsible defaultOpen={skills.length > 0 || panel?.section === 'skills'} summary={countLabel(skills.length, 'skill')}>\n {refList('skills', skills, 'Skill')}\n {addButtons('skills', 'Write a skill')}\n {registry && <AgentProfileRegistrySkillSearch registry={registry} disabled={editingDisabled} existing={skills}\n validate={ref => skillIssue(ref, skills, skills.length)}\n onAdd={ref => resources('skills', [...skills, ref])} />}\n </Section>}\n\n {show.toolFiles && <Section title=\"Tool files\" description=\"Files that define custom tools.\"\n collapsible defaultOpen={toolFiles.length > 0} summary={countLabel(toolFiles.length, 'file')}>\n {refList('tools', toolFiles, 'Tool file')}\n {addButtons('tools', 'Write a tool file')}\n </Section>}\n\n {show.mcp && <Section title=\"MCP servers\" description=\"Tool servers the agent connects to.\"\n collapsible defaultOpen={Object.keys(value.mcp ?? {}).length > 0} summary={countLabel(Object.keys(value.mcp ?? {}).length, 'server')}>\n <McpServersEditor servers={value.mcp ?? {}} disabled={editingDisabled} port={config?.mcp?.port} lockReason={config?.mcp?.lockReason}\n publicHttpsOnly={publicHttpsMcpOnly} allowLocalCommand={config?.mcp?.allowLocalCommand ?? !publicHttpsMcpOnly}\n registry={registry} onPendingChange={setMcpPending}\n onChange={next => { const { mcp: _mcp, ...rest } = value; return emit(Object.keys(next).length ? { ...value, mcp: next } : rest) }} />\n </Section>}\n\n {show.files && <Section title=\"Resource files\" description=\"Reference files placed in the agent's workspace.\"\n collapsible defaultOpen={files.length > 0 || panel?.section === 'files'} summary={countLabel(files.length, 'file')}>\n {files.length === 0 && <p className={formText.muted}>No resource files yet.</p>}\n {files.length > 0 && <ul className=\"divide-y divide-border rounded-lg border border-border\">{files.map((mount, index) => {\n const issue = fileIssue(mount, index)\n const editing = panel?.kind === 'edit' && panel.section === 'files' && panel.index === index\n return <li key={`${mount.path}-${index}`} className=\"space-y-3 p-3\" aria-label={`Resource file ${mount.path}`}>\n <div className={listRow}>\n <div className=\"min-w-0\">\n <p className={`break-words [overflow-wrap:anywhere] ${formText.label}`}>{mount.path}</p>\n <p className={`break-words ${formText.muted}`}>{sourceLine(mount.resource)}{mount.executable ? ' · Executable' : ''}</p>\n {issue && <p className={formText.error}>{issue}</p>}\n </div>\n {rowActions(mount.path, 'files', index, mount.resource)}\n </div>\n {editing && (mount.resource.kind === 'github' && github ? githubEditor('files', index) : inlineEditor('files', index))}\n </li>\n })}</ul>}\n {panel && panel.kind !== 'edit' && panel.section === 'files' && addButtons('files', 'Write a file')}\n <ResourceFileDrop existingPaths={files.map(mount => mount.path)} pathPrefix={workspaceFilePrefix} limits={config?.files}\n disabled={editingDisabled} actions={!(panel && panel.kind !== 'edit' && panel.section === 'files') && <>\n {github && <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-github', section: 'files' })}>Add from GitHub</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={editingDisabled}\n onClick={() => openPanel({ kind: 'add-inline', section: 'files' })}>Write a file</Button>\n </>} onAdd={added => {\n const mounts = added.map(({ path, file }) => ({ path, resource: { kind: 'inline' as const, name: file.name, content: file.content } }))\n const next = [...files, ...mounts]\n const issue = mounts.map((mount, offset) => fileIssue(mount, files.length + offset)).find(Boolean)\n if (issue) return issue\n return setFiles(next) ? null : 'The profile did not accept these files.'\n }} />\n </Section>}\n\n {show.advanced && <Section title=\"Advanced JSON\" description=\"The complete profile, including hooks, modes, connections, and extensions.\" collapsible>\n <label htmlFor={`${id}-json`} className=\"sr-only\">Full profile JSON</label>\n <Textarea id={`${id}-json`} className=\"min-h-72 font-mono text-sm leading-6\" spellCheck={false} disabled={disabled} value={json}\n onChange={event => { setJson(event.target.value); setJsonDirty(true) }} />\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={disabled || !jsonDirty} onClick={applyJson}>Apply JSON</Button>\n {jsonDirty && <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={disabled}\n onClick={() => { setJson(JSON.stringify(value, null, 2)); setJsonDirty(false); setError(null) }}>Discard JSON edits</Button>}\n </div>\n <p className={formText.muted}>Reference credentials by secret name; never paste them into a profile.</p>\n </Section>}\n </div>\n </TooltipProvider>\n}\n\nfunction GitHubFilePath({ check, id, value, prefix, disabled, onChange, issue }: {\n check: GitHubSourceCheck | null\n id: string\n value: string\n prefix: string\n disabled: boolean\n onChange: (path: string) => void\n issue: string | null\n}) {\n const suggested = check ? prefix + basename(check.path) : ''\n // Suggest a path when a new source is checked; the person's own path stays.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useEffect(() => { if (suggested && !value) onChange(suggested) }, [suggested])\n return <Field label=\"Workspace path\" htmlFor={id} error={issue} hint={!issue && prefix ? `Files go under ${prefix}` : undefined}>\n <Input id={id} size=\"compact\" value={value} disabled={disabled || !check} placeholder={prefix + 'guide.md'} {...noAutofill}\n aria-invalid={issue ? true : undefined} aria-describedby={fieldMessageId(id)} onChange={event => onChange(event.target.value)} />\n </Field>\n}\n\n","import { useRef, useState } from 'react'\nimport type { AgentProfileMcpServer, AgentProfileResourceRef } from '@tangle-network/agent-interface/profile'\nimport { Button, Input } from '@tangle-network/sandbox-ui/primitives'\nimport { AgentProfileRegistryError, type AgentProfileRegistryMcpServer, type AgentProfileRegistryPort,\n type AgentProfileRegistrySkill } from './agent-profile-registry'\n\ninterface SearchState<T> {\n status: 'idle' | 'searching' | 'done'\n results: readonly T[]\n unavailable: readonly string[]\n failure: { kind: 'authorization-required' | 'unavailable' | 'failed'; message: string } | null\n}\n\nconst idle: SearchState<never> = { status: 'idle', results: [], unavailable: [], failure: null }\n\nfunction failureOf(cause: unknown): SearchState<never>['failure'] {\n if (cause instanceof AgentProfileRegistryError) return { kind: cause.kind, message: cause.message }\n return { kind: 'failed', message: cause instanceof Error ? cause.message : 'Registry search failed.' }\n}\n\nfunction failureText(failure: NonNullable<SearchState<never>['failure']>): string {\n if (failure.kind === 'authorization-required') {\n return 'Registry search needs authorization. Sign in again or ask a workspace owner.'\n }\n if (failure.kind === 'unavailable') return failure.message || 'Registry search is unavailable right now.'\n return failure.message || 'Registry search failed.'\n}\n\nfunction useRegistrySearch<T>(search: (query: string, signal: AbortSignal) => Promise<{ items: readonly T[]; unavailable?: readonly string[] }>) {\n const [state, setState] = useState<SearchState<T>>(idle as SearchState<T>)\n const request = useRef(0)\n\n async function run(query: string) {\n const text = query.trim()\n if (!text) return\n const epoch = ++request.current\n const controller = new AbortController()\n setState(current => ({ ...current, status: 'searching', failure: null }))\n try {\n const result = await search(text, controller.signal)\n if (request.current !== epoch) return\n setState({ status: 'done', results: result.items, unavailable: result.unavailable ?? [], failure: null })\n } catch (cause) {\n if (request.current !== epoch) return\n setState({ status: 'done', results: [], unavailable: [], failure: failureOf(cause) })\n }\n }\n\n return { state, run }\n}\n\nfunction SearchBox({ label, placeholder, disabled, onSearch }: {\n label: string\n placeholder: string\n disabled: boolean\n onSearch: (query: string) => void\n}) {\n const [query, setQuery] = useState('')\n return <div className=\"flex gap-2\">\n <Input aria-label={label} disabled={disabled} value={query} placeholder={placeholder}\n onChange={event => setQuery(event.target.value)}\n onKeyDown={event => { if (event.key === 'Enter') { event.preventDefault(); onSearch(query) } }} />\n <Button type=\"button\" variant=\"outline\" disabled={disabled || !query.trim()} onClick={() => onSearch(query)}>Search</Button>\n </div>\n}\n\nfunction SearchStatus<T>({ state, empty }: { state: SearchState<T>; empty: string }) {\n return <>\n {state.status === 'searching' && <p role=\"status\" className=\"text-xs text-muted-foreground\">Searching…</p>}\n {state.failure && <p role=\"alert\" className=\"text-xs text-destructive\">{failureText(state.failure)}</p>}\n {!state.failure && state.unavailable.length > 0 && <p role=\"status\" className=\"text-xs text-muted-foreground\">\n Some catalogs could not answer: {state.unavailable.join(', ')}.</p>}\n {state.status === 'done' && !state.failure && state.results.length === 0 &&\n <p className=\"text-xs text-muted-foreground\">{empty}</p>}\n </>\n}\n\nexport function AgentProfileRegistrySkillSearch({ registry, disabled, existing, validate, onAdd }: {\n registry: AgentProfileRegistryPort\n disabled: boolean\n existing: readonly AgentProfileResourceRef[]\n /** Product constraints; returns the reason a result cannot be added, or null when it can. */\n validate: (ref: AgentProfileResourceRef) => string | null\n onAdd: (ref: AgentProfileResourceRef) => boolean\n}) {\n const { state, run } = useRegistrySearch<AgentProfileRegistrySkill>(async (query, signal) => {\n const result = await registry.searchSkills(query, signal)\n return { items: result.skills, unavailable: result.unavailable }\n })\n const [added, setAdded] = useState<readonly string[]>([])\n\n return <div className=\"space-y-2 rounded-lg border border-border p-3\">\n <p className=\"text-sm font-medium text-foreground\">Find skills in maintained catalogs</p>\n <p className=\"text-xs text-muted-foreground\">Search shows each skill's source and declared permissions. Adding a skill saves a reference; nothing is installed until the profile runs.</p>\n <SearchBox label=\"Search skill catalogs\" placeholder=\"Search skills\" disabled={disabled || state.status === 'searching'}\n onSearch={query => void run(query)} />\n <SearchStatus state={state} empty=\"No skills matched that search.\" />\n {state.results.length > 0 && <ul className=\"space-y-2\">{state.results.map((skill, index) => {\n const configured = existing.some(ref => ref.name === skill.name) || added.includes(skill.name)\n const issue = configured ? null : validate(skill.ref)\n return <li key={`${skill.catalog}:${skill.name}:${index}`} className=\"space-y-1 rounded-lg border border-border p-3 text-sm\"\n aria-label={`Catalog skill ${skill.name}`}>\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <span className=\"block break-words font-medium text-foreground\">{skill.name}</span>\n <span className=\"block text-xs text-muted-foreground\">{skill.catalog}</span>\n </div>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" disabled={disabled || configured || Boolean(issue)}\n aria-label={`Add skill ${skill.name}`}\n onClick={() => { if (onAdd(skill.ref)) setAdded(current => [...current, skill.name]) }}>\n {configured ? 'Added' : 'Add skill'}</Button>\n </div>\n {skill.description && <p className=\"text-xs text-muted-foreground\">{skill.description}</p>}\n {skill.ref.kind === 'github' && <p className=\"break-words text-xs text-muted-foreground\">\n Source: {skill.ref.repository} / {skill.ref.path}{skill.ref.ref ? ` @ ${skill.ref.ref}` : ''}</p>}\n {skill.permissions && skill.permissions.length > 0 &&\n <p className=\"text-xs text-muted-foreground\">Requests: {skill.permissions.join(', ')}</p>}\n {issue && <p className=\"text-xs text-destructive\">{issue}</p>}\n </li> })}</ul>}\n </div>\n}\n\nexport function AgentProfileRegistryMcpSearch({ registry, disabled, existingNames, validate, onAdd }: {\n registry: AgentProfileRegistryPort\n disabled: boolean\n existingNames: readonly string[]\n validate: (name: string, server: AgentProfileMcpServer) => string | null\n onAdd: (name: string, server: AgentProfileMcpServer) => boolean\n}) {\n const { state, run } = useRegistrySearch<AgentProfileRegistryMcpServer>(async (query, signal) => {\n const result = await registry.searchMcpServers(query, signal)\n return { items: result.mcpServers, unavailable: result.unavailable }\n })\n const [added, setAdded] = useState<readonly string[]>([])\n\n return <div className=\"space-y-2 rounded-lg border border-border p-3\">\n <p className=\"text-sm font-medium text-foreground\">Find MCP servers in registries</p>\n <p className=\"text-xs text-muted-foreground\">Results come from the official MCP Registry and configured custom registries. Listing does not imply trust or authorize installation.</p>\n <SearchBox label=\"Search MCP registries\" placeholder=\"Search MCP servers\" disabled={disabled || state.status === 'searching'}\n onSearch={query => void run(query)} />\n <SearchStatus state={state} empty=\"No MCP servers matched that search.\" />\n {state.results.length > 0 && <ul className=\"space-y-2\">{state.results.map((item, index) => {\n const configured = existingNames.includes(item.name) || added.includes(item.name)\n const issue = configured ? null : validate(item.name, item.server)\n return <li key={`${item.catalog}:${item.name}:${index}`} className=\"space-y-1 rounded-lg border border-border p-3 text-sm\"\n aria-label={`Registry server ${item.name}`}>\n <div className=\"flex flex-wrap items-start justify-between gap-2\">\n <div className=\"min-w-0\">\n <span className=\"block break-words font-medium text-foreground\">{item.name}</span>\n <span className=\"block text-xs text-muted-foreground\">{item.catalog}</span>\n </div>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" disabled={disabled || configured || Boolean(issue)}\n aria-label={`Add server ${item.name}`}\n onClick={() => { if (onAdd(item.name, item.server)) setAdded(current => [...current, item.name]) }}>\n {configured ? 'Added' : 'Add server'}</Button>\n </div>\n {item.description && <p className=\"text-xs text-muted-foreground\">{item.description}</p>}\n <p className=\"break-words text-xs text-muted-foreground\">{'command' in item.server ? `Command: ${item.server.command}` : `URL: ${item.server.url}`}</p>\n {issue && <p className=\"text-xs text-destructive\">{issue}</p>}\n </li> })}</ul>}\n </div>\n}\n","import type { AgentProfileMcpServer, AgentProfileResourceRef } from '@tangle-network/agent-interface/profile'\n\n/**\n * Registry discovery port for the shared profile editor (agent-app#776).\n * The host authenticates and bounds every search server-side; the editor\n * never talks to a catalog directly. Discovery never implies trust,\n * authorization, or installation: choosing a result only adds the canonical\n * reference to the profile draft, and the product's own constraints\n * (pinned commits, HTTPS-only endpoints, unique names) still decide whether\n * the reference may be added.\n */\n\n/** A skill offered by a maintained catalog. */\nexport interface AgentProfileRegistrySkill {\n /** Canonical skill name; the product's format and uniqueness rules still apply. */\n name: string\n /** What the skill is for, from the catalog. */\n description?: string\n /** Display name of the catalog that answered, for example `Tangle Network skills`. */\n catalog: string\n /** Permissions the skill declares, shown before the operator adds it. */\n permissions?: readonly string[]\n /** Canonical reference added to the profile when the operator chooses this skill. */\n ref: AgentProfileResourceRef\n}\n\n/** An MCP server offered by the official MCP Registry or a custom registry. */\nexport interface AgentProfileRegistryMcpServer {\n /** Canonical server name; existing profile entries win over duplicates. */\n name: string\n /** What the server provides, from the registry. */\n description?: string\n /** Display name of the registry that answered, for example `Official MCP Registry`. */\n catalog: string\n /** Canonical server entry added to the profile when the operator chooses it. */\n server: AgentProfileMcpServer\n}\n\nexport interface AgentProfileRegistrySkillsResult {\n skills: readonly AgentProfileRegistrySkill[]\n /** Catalogs that could not answer; results from the remaining catalogs stay usable. */\n unavailable?: readonly string[]\n}\n\nexport interface AgentProfileRegistryMcpResult {\n mcpServers: readonly AgentProfileRegistryMcpServer[]\n unavailable?: readonly string[]\n}\n\n/** Registry search failures the editor renders distinctly. */\nexport type AgentProfileRegistryFailure = 'authorization-required' | 'unavailable' | 'failed'\n\nexport class AgentProfileRegistryError extends Error {\n constructor(readonly kind: AgentProfileRegistryFailure, message: string) {\n super(message)\n this.name = 'AgentProfileRegistryError'\n }\n}\n\n/** Host-supplied registry search. Implementations must time out and never install anything. */\nexport interface AgentProfileRegistryPort {\n searchSkills(query: string, signal?: AbortSignal): Promise<AgentProfileRegistrySkillsResult>\n searchMcpServers(query: string, signal?: AbortSignal): Promise<AgentProfileRegistryMcpResult>\n}\n","/**\n * Layout and text conventions for the profile editor, kept in one place so\n * every section uses one type size, one spacing scale, and one control height.\n *\n * Type: 14px (`text-sm`) for labels, values, help, status, and errors; section\n * titles are 16px semibold. Nothing in the form is smaller.\n * Spacing: 8px from a label to its control, 16px between fields, 16px between\n * sections. Controls: `--control-height` for inputs, selects, pickers, and\n * buttons (`size=\"compact\"`).\n *\n * Two-column field rows respond to the editor's own width through a container\n * query, so the form stays single-column inside a narrow side panel on a wide\n * screen.\n */\nimport { useId, useState, type ReactNode } from 'react'\nimport { Tooltip, TooltipContent, TooltipTrigger } from '@tangle-network/ui/primitives'\n\nexport const formText = {\n body: 'text-sm leading-6 text-foreground',\n muted: 'text-sm leading-6 text-muted-foreground',\n error: 'text-sm leading-6 text-destructive',\n label: 'text-sm font-medium leading-6 text-foreground',\n /** Section titles are the one step up: 16px semibold. */\n title: 'text-base font-semibold leading-6 text-foreground',\n} as const\n\n/** Two fields side by side once the editor is at least 36rem wide. */\nexport const formRow = 'grid gap-4 @xl/profile-editor:grid-cols-2'\n\n/** A list row: its text, then its actions beside it when the editor is wide enough, or below it when narrow. */\nexport const listRow = 'flex flex-col gap-1 @lg/profile-editor:flex-row @lg/profile-editor:items-start @lg/profile-editor:justify-between @lg/profile-editor:gap-3'\n\n/** Row actions are ghost buttons; pulling them left by their padding lines their text up with the row's text when stacked. */\nexport const rowActions = 'flex shrink-0 flex-wrap gap-1 -ml-3 @lg/profile-editor:ml-0'\n\nfunction InfoGlyph({ className }: { className?: string }) {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"M12 16v-4M12 8h.01\" />\n </svg>\n}\n\n/**\n * An info button beside a label. It opens on hover and keyboard focus, and\n * toggles on tap, so the help is reachable on touch screens too.\n */\nfunction InfoHint({ label, children }: { label: string; children: ReactNode }) {\n const [open, setOpen] = useState(false)\n return <Tooltip open={open} onOpenChange={setOpen} delayDuration={150}>\n <TooltipTrigger asChild>\n <button type=\"button\" aria-label={`About ${label}`} onClick={() => setOpen(current => !current)}\n className=\"inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\">\n <InfoGlyph className=\"size-4\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-72 text-sm leading-5\">{children}</TooltipContent>\n </Tooltip>\n}\n\nexport interface FieldProps {\n label: string\n /** The control's id; the label targets it. */\n htmlFor: string\n /** Help that explains what the setting does, shown from an info button. */\n info?: ReactNode\n /** One short sentence the person needs to fill the field in. */\n hint?: ReactNode\n /** A validation error. The control should set `aria-invalid` and reference {@link fieldMessageId}. */\n error?: ReactNode\n /** A non-error status, such as a check that passed. */\n status?: ReactNode\n /** Trailing content in the label row, such as a \"Use default\" action. */\n aside?: ReactNode\n children: ReactNode\n}\n\n/** The id of a field's hint, error, or status line, for the control's `aria-describedby`. */\nexport function fieldMessageId(htmlFor: string): string {\n return `${htmlFor}-message`\n}\n\nexport function Field({ label, htmlFor, info, hint, error, status, aside, children }: FieldProps) {\n const message = error ?? status ?? hint\n return <div className=\"min-w-0 space-y-2\">\n <div className=\"flex min-h-6 items-center justify-between gap-2\">\n <span className=\"flex min-w-0 items-center gap-1.5\">\n <label htmlFor={htmlFor} className={formText.label}>{label}</label>\n {info && <InfoHint label={label}>{info}</InfoHint>}\n </span>\n {aside}\n </div>\n {children}\n {message && <div id={fieldMessageId(htmlFor)} role={error ? 'alert' : undefined}\n className={error ? formText.error : formText.muted}>{message}</div>}\n </div>\n}\n\nexport interface SectionProps {\n title: string\n /** One sentence on what the section controls. */\n description?: ReactNode\n /** Short trailing summary, such as \"3 skills\". */\n summary?: ReactNode\n /** Collapsible sections start closed unless this is set. */\n defaultOpen?: boolean\n collapsible?: boolean\n children: ReactNode\n}\n\nfunction Chevron({ className }: { className?: string }) {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className={className} fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"m6 9 6 6 6-6\" /></svg>\n}\n\n/** A bordered section. Collapsible sections use a native disclosure so they work without script. */\nexport function Section({ title, description, summary, defaultOpen = false, collapsible = false, children }: SectionProps) {\n const headingId = useId()\n const header = <span className=\"flex min-w-0 flex-1 items-start justify-between gap-3\">\n <span className=\"min-w-0 space-y-0.5\">\n <span id={headingId} className={`block ${formText.title}`}>{title}</span>\n {description && <span className={`block ${formText.muted}`}>{description}</span>}\n </span>\n {(summary || collapsible) && <span className={`flex shrink-0 items-center gap-2 ${formText.muted}`}>\n {summary}\n {collapsible && <Chevron className=\"size-4 transition-transform group-open:rotate-180\" />}\n </span>}\n </span>\n if (!collapsible) {\n return <section aria-labelledby={headingId} className=\"min-w-0 rounded-xl border border-border bg-card\">\n <header className=\"flex px-4 pt-4\">{header}</header>\n <div className=\"min-w-0 space-y-4 p-4\">{children}</div>\n </section>\n }\n return <details open={defaultOpen || undefined} className=\"group min-w-0 rounded-xl border border-border bg-card\">\n <summary aria-labelledby={headingId} className=\"flex cursor-pointer list-none rounded-xl p-4 marker:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden\">\n {header}\n </summary>\n <div className=\"min-w-0 space-y-4 border-t border-border p-4\">{children}</div>\n </details>\n}\n\nexport type StatusTone = 'neutral' | 'pending' | 'success' | 'warning' | 'error'\n\nconst toneClass: Record<StatusTone, string> = {\n neutral: 'text-muted-foreground',\n pending: 'text-muted-foreground',\n success: 'text-[var(--surface-success-text,hsl(var(--success)))]',\n warning: 'text-warning-strong',\n error: 'text-destructive',\n}\n\nfunction StatusGlyph({ tone }: { tone: StatusTone }) {\n if (tone === 'pending') {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0 animate-spin motion-reduce:animate-none\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\"><path d=\"M21 12a9 9 0 1 1-6.2-8.6\" /></svg>\n }\n if (tone === 'success') {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"m8 12 3 3 5-6\" /></svg>\n }\n if (tone === 'error' || tone === 'warning') {\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\" /><path d=\"M12 8v4M12 16h.01\" /></svg>\n }\n return <svg aria-hidden=\"true\" viewBox=\"0 0 24 24\" className=\"size-4 shrink-0\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><circle cx=\"12\" cy=\"12\" r=\"3\" /></svg>\n}\n\n/** An inline status with an icon: a check in progress, a passed check, or a failure. */\nexport function StatusLine({ tone, children, id }: { tone: StatusTone; children: ReactNode; id?: string }) {\n return <p id={id} role={tone === 'error' ? 'alert' : 'status'} className={`flex items-start gap-2 text-sm leading-6 ${toneClass[tone]}`}>\n <span className=\"flex h-6 items-center\"><StatusGlyph tone={tone} /></span>\n <span className=\"min-w-0 break-words [overflow-wrap:anywhere]\">{children}</span>\n </p>\n}\n\n/** A short state label with a dot, for list rows. */\nexport function StatusPill({ tone, children }: { tone: StatusTone; children: ReactNode }) {\n return <span className={`inline-flex shrink-0 items-center gap-1.5 text-sm leading-6 ${toneClass[tone]}`}>\n {tone === 'pending'\n ? <StatusGlyph tone=\"pending\" />\n : <span aria-hidden=\"true\" className=\"size-2 rounded-full bg-current\" />}\n {children}\n </span>\n}\n\n/** A banner for a form-wide state, such as an error the person must fix before saving. */\nexport function Notice({ tone, children }: { tone: 'error' | 'info'; children: ReactNode }) {\n return <div role={tone === 'error' ? 'alert' : 'status'} className={`rounded-lg border p-3 text-sm leading-6 ${tone === 'error'\n ? 'border-destructive/40 bg-destructive/5 text-foreground'\n : 'border-border bg-muted/50 text-foreground'}`}>{children}</div>\n}\n\n/** Attributes that keep password managers and browser autofill off fields that are not credentials. */\nexport const noAutofill = {\n autoComplete: 'off',\n 'data-1p-ignore': 'true',\n 'data-lpignore': 'true',\n 'data-bwignore': 'true',\n 'data-form-type': 'other',\n spellCheck: false,\n} as const\n","/**\n * Choose a file from GitHub for a skill or a resource file. Repositories and\n * paths autocomplete from the workspace's GitHub connection, the version is the\n * default branch's latest commit unless the person pins a SHA, and the chosen\n * file is read and checked before it can be added.\n */\nimport { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'\nimport { Button, Input } from '@tangle-network/sandbox-ui/primitives'\nimport { SegmentedControl } from '@tangle-network/ui/primitives'\nimport {\n isCommitSha, parseGitHubLocation,\n type GitHubCommitSummary, type GitHubFileList, type GitHubRepositorySummary, type GitHubSourceCheck,\n type GitHubSourceFailure, type GitHubSourceOutcome, type GitHubSourcePurpose, type ProfileEditorGitHubPort,\n} from '../profile-editor'\nimport { Field, fieldMessageId, formRow, formText, noAutofill, StatusLine } from './agent-profile-form-kit'\nimport { SuggestInput, type Suggestion } from './agent-profile-suggest-input'\n\ntype Load<T> = { state: 'idle' } | { state: 'loading' } | { state: 'done'; value: T } | { state: 'failed'; failure: GitHubSourceFailure }\n\n/** Run a lookup whenever its key changes, cancelling the previous one. */\nfunction useLookup<T>(key: string | null, run: (signal: AbortSignal) => Promise<GitHubSourceOutcome<T>>, delayMs = 0): Load<T> {\n const [load, setLoad] = useState<Load<T>>({ state: 'idle' })\n const runRef = useRef(run)\n runRef.current = run\n useEffect(() => {\n if (key === null) { setLoad({ state: 'idle' }); return }\n const controller = new AbortController()\n setLoad({ state: 'loading' })\n const timer = setTimeout(() => {\n runRef.current(controller.signal).then(outcome => {\n if (controller.signal.aborted) return\n setLoad(outcome.ok ? { state: 'done', value: outcome.value } : { state: 'failed', failure: outcome })\n }, (cause: unknown) => {\n if (controller.signal.aborted) return\n setLoad({ state: 'failed', failure: { ok: false, problem: 'unavailable', message: cause instanceof Error ? cause.message : 'The lookup failed.' } })\n })\n }, delayMs)\n return () => { clearTimeout(timer); controller.abort() }\n }, [key, delayMs])\n return load\n}\n\nfunction shortSha(sha: string): string {\n return sha.slice(0, 7)\n}\n\nfunction relativeDate(iso?: string): string | null {\n if (!iso) return null\n const time = Date.parse(iso)\n if (Number.isNaN(time)) return null\n const days = Math.floor((Date.now() - time) / 86_400_000)\n if (days <= 0) return 'today'\n if (days === 1) return 'yesterday'\n if (days < 30) return `${days} days ago`\n return new Date(time).toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })\n}\n\nfunction describeCommit(commit: GitHubCommitSummary): string {\n const when = relativeDate(commit.committedAt)\n return [shortSha(commit.sha), commit.message, when].filter(Boolean).join(' · ')\n}\n\nfunction rankPaths(files: GitHubFileList['files'], query: string, purpose: GitHubSourcePurpose): Suggestion[] {\n const needle = query.trim().toLowerCase()\n const candidates = purpose === 'skill' ? files.filter(file => /(^|\\/)SKILL\\.md$/i.test(file.path)) : files\n const pool = candidates.length || purpose !== 'skill' ? candidates : files\n return pool\n .filter(file => !needle || file.path.toLowerCase().includes(needle))\n .sort((left, right) => {\n const leftStarts = needle && left.path.toLowerCase().startsWith(needle) ? 0 : 1\n const rightStarts = needle && right.path.toLowerCase().startsWith(needle) ? 0 : 1\n return leftStarts - rightStarts || left.path.split('/').length - right.path.split('/').length || left.path.localeCompare(right.path)\n })\n .slice(0, 50)\n .map(file => ({ value: file.path, label: file.path }))\n}\n\ninterface GitHubSourceSelection {\n check: GitHubSourceCheck\n}\n\nexport interface GitHubSourcePickerProps {\n port: ProfileEditorGitHubPort\n purpose: GitHubSourcePurpose\n disabled?: boolean\n /** Where the person connects GitHub, shown when the workspace has no connection. */\n connectHref?: string\n /** Called with the checked source. The caller adds it to the profile and closes the picker. */\n onChoose: (selection: GitHubSourceSelection) => void\n /** The label for the add action, for example \"Add skill\". */\n actionLabel: string\n /** Fields the caller needs beside the source, such as the skill name; rendered above the action. */\n children?: (check: GitHubSourceCheck | null) => ReactNode\n /** The reason the caller's fields block adding, or null. */\n blocked?: string | null\n /** Initial values, for editing an existing GitHub source. */\n initial?: { repository?: string; path?: string; ref?: string }\n onCancel: () => void\n}\n\nexport function GitHubSourcePicker({ port, purpose, disabled = false, connectHref, onChoose, actionLabel, children, blocked = null, initial, onCancel }: GitHubSourcePickerProps) {\n const uid = useId()\n const fieldId = (name: 'repository' | 'version' | 'sha' | 'path') => `github-${name}${uid}`\n\n const [repositoryText, setRepositoryText] = useState(initial?.repository ?? '')\n const [repository, setRepository] = useState(initial?.repository ?? '')\n const [version, setVersion] = useState<'latest' | 'pinned'>(initial?.ref && isCommitSha(initial.ref) ? 'pinned' : 'latest')\n const [shaText, setShaText] = useState(initial?.ref && isCommitSha(initial.ref) ? initial.ref : '')\n const [pathText, setPathText] = useState(initial?.path ?? '')\n const [path, setPath] = useState(initial?.path ?? '')\n\n const repositories = useLookup('repositories', signal => port.repositories(signal))\n const latest = useLookup(repository || null, signal => port.latest(repository, signal))\n const pinnedSha = version === 'pinned' && isCommitSha(shaText.trim()) ? shaText.trim().toLowerCase() : null\n const pinned = useLookup(repository && pinnedSha ? `${repository}@${pinnedSha}` : null,\n signal => port.commit(repository, pinnedSha!, signal), 300)\n const commit: GitHubCommitSummary | null = version === 'latest'\n ? latest.state === 'done' ? latest.value.commit : null\n : pinned.state === 'done' ? pinned.value : null\n const files = useLookup(repository && commit ? `${repository}@${commit.sha}` : null,\n signal => port.files(repository, commit!.sha, signal))\n const check = useLookup(repository && commit && path ? `${repository}@${commit.sha}:${path}:${purpose}` : null,\n signal => port.check({ repository, path, commit: commit!.sha, purpose }, signal), 150)\n\n const notConnected = repositories.state === 'failed' && repositories.failure.problem === 'not-connected'\n ? repositories.failure\n : latest.state === 'failed' && latest.failure.problem === 'not-connected' ? latest.failure : null\n\n const repositorySuggestions = useMemo<Suggestion[]>(() => {\n if (repositories.state !== 'done') return []\n const needle = repositoryText.trim().toLowerCase()\n return repositories.value.repositories\n .filter((item: GitHubRepositorySummary) => !needle || item.fullName.toLowerCase().includes(needle))\n .slice(0, 50)\n .map(item => ({ value: item.fullName, label: item.fullName,\n detail: [item.private ? 'Private' : 'Public', item.description].filter(Boolean).join(' · ') }))\n }, [repositories, repositoryText])\n\n const pathSuggestions = useMemo(() => files.state === 'done' ? rankPaths(files.value.files, pathText, purpose) : [],\n [files, pathText, purpose])\n\n function commitRepository(text: string) {\n const location = parseGitHubLocation(text)\n if (!location) { setRepository(''); return }\n setRepositoryText(location.repository)\n setRepository(location.repository)\n if (location.ref && isCommitSha(location.ref)) { setVersion('pinned'); setShaText(location.ref) }\n if (location.path) { setPathText(location.path); setPath(location.path) }\n }\n\n if (notConnected) {\n return <div className=\"space-y-3\">\n <StatusLine tone=\"neutral\">{notConnected.message}</StatusLine>\n <div className=\"flex flex-wrap gap-2\">\n {connectHref && <Button asChild size=\"compact\"><a href={connectHref}>Connect GitHub</a></Button>}\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n }\n\n const repositoryInvalid = repositoryText.trim() !== '' && repository === '' && !parseGitHubLocation(repositoryText)\n const repositoryMessage = repositoryInvalid\n ? <span className={formText.error}>Enter a repository as owner/repo, or paste its GitHub link.</span>\n : latest.state === 'failed' ? <span className={formText.error}>{latest.failure.message}</span>\n : latest.state === 'loading' ? <StatusLine tone=\"pending\">Checking {repository}…</StatusLine>\n : latest.state === 'done' ? <StatusLine tone=\"success\">{latest.value.repository.private ? 'Private' : 'Public'} · default branch {latest.value.repository.defaultBranch}</StatusLine>\n : repositories.state === 'failed' ? <span className={formText.muted}>{repositories.failure.message}</span>\n : undefined\n const shaInvalid = version === 'pinned' && shaText.trim() !== '' && !isCommitSha(shaText.trim())\n const versionMessage = version === 'latest'\n ? latest.state === 'done' ? <span className={formText.muted}>{describeCommit(latest.value.commit)}</span> : undefined\n : shaInvalid ? <span className={formText.error}>Enter the full 40-character commit SHA.</span>\n : pinned.state === 'failed' ? <span className={formText.error}>{pinned.failure.message}</span>\n : pinned.state === 'loading' ? <StatusLine tone=\"pending\">Looking up the commit…</StatusLine>\n : pinned.state === 'done' ? <StatusLine tone=\"success\">{describeCommit(pinned.value)}</StatusLine>\n : undefined\n const checked = check.state === 'done' ? check.value : null\n const pathMessage = !commit ? undefined\n : files.state === 'failed' ? <span className={formText.error}>{files.failure.message}</span>\n : check.state === 'loading' ? <StatusLine tone=\"pending\">Reading {path}…</StatusLine>\n : check.state === 'failed' ? <span className={formText.error}>{check.failure.message}</span>\n : checked ? <StatusLine tone=\"success\">{checked.skill\n ? <>Skill <span className=\"font-medium\">{checked.skill.name}</span>: {checked.skill.description}</>\n : <>{checked.path} · {Math.max(1, Math.round(checked.size / 1024))} KB</>}</StatusLine>\n : files.state === 'done' && files.value.truncated ? <span className={formText.muted}>This repository is large; type the full path if it is not suggested.</span>\n : undefined\n const ready = checked !== null && !blocked && !disabled\n\n return <div className=\"space-y-4\">\n <Field label=\"Repository\" htmlFor={fieldId('repository')} error={undefined} hint={repositoryMessage}>\n <SuggestInput id={fieldId('repository')} value={repositoryText} disabled={disabled}\n placeholder={repositories.state === 'done' ? 'Search your repositories' : 'owner/repo'}\n onChange={setRepositoryText} onCommit={commitRepository}\n suggestions={repositorySuggestions} loading={repositories.state === 'loading' && repositoryText === ''}\n emptyText={repositories.state === 'done' ? 'No matching repositories. Press Enter to use what you typed.' : undefined}\n invalid={repositoryInvalid || latest.state === 'failed'} describedBy={fieldMessageId(fieldId('repository'))} />\n </Field>\n <div className={formRow}>\n <Field label=\"Version\" htmlFor={fieldId('version')} hint={versionMessage}>\n <SegmentedControl id={fieldId('version')} aria-label=\"Version\" value={version}\n onValueChange={next => setVersion(next)}\n options={[{ value: 'latest', label: 'Latest commit' }, { value: 'pinned', label: 'Pin a commit' }]}\n className=\"h-[var(--control-height)] w-full flex-nowrap p-0.5 [&_button]:h-full [&_button]:flex-1 [&_button]:justify-center [&_button]:py-0\" />\n </Field>\n {version === 'pinned' && <Field label=\"Commit SHA\" htmlFor={fieldId('sha')}>\n <Input id={fieldId('sha')} size=\"compact\" value={shaText} disabled={disabled} placeholder=\"40-character SHA\"\n aria-invalid={shaInvalid || pinned.state === 'failed' || undefined} {...noAutofill}\n className=\"font-mono\" onChange={event => setShaText(event.target.value)} />\n </Field>}\n </div>\n <Field label={purpose === 'skill' ? 'Skill file' : 'File'} htmlFor={fieldId('path')} hint={pathMessage}>\n <SuggestInput id={fieldId('path')} value={pathText} disabled={disabled || !commit}\n placeholder={purpose === 'skill' ? 'skills/research/SKILL.md' : 'docs/guide.md'}\n onChange={setPathText} onCommit={next => setPath(next)}\n suggestions={pathSuggestions} loading={files.state === 'loading'}\n emptyText={files.state === 'done' ? (purpose === 'skill' ? 'No SKILL.md files match.' : 'No files match.') : undefined}\n invalid={check.state === 'failed'} describedBy={fieldMessageId(fieldId('path'))} />\n </Field>\n {children?.(checked)}\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" size=\"compact\" disabled={!ready} onClick={() => { if (checked) onChoose({ check: checked }) }}>{actionLabel}</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n}\n","/**\n * A text field with a suggestion list: type to filter, arrow keys to move,\n * Enter to choose. The person may also keep what they typed, so a value the\n * suggestions do not contain (a repository the listing missed, a path in a\n * truncated tree) is still enterable. The list renders through\n * `PopoverSurface`, so a scrolling side panel cannot clip it.\n */\nimport { useEffect, useId, useRef, useState, type ReactNode } from 'react'\nimport { Input } from '@tangle-network/sandbox-ui/primitives'\nimport { OVERLAY_SHADOW, PopoverSurface, POPOVER_OPTION_FOCUS } from './controls'\nimport { noAutofill } from './agent-profile-form-kit'\n\nexport interface Suggestion {\n value: string\n label: ReactNode\n detail?: ReactNode\n}\n\nexport interface SuggestInputProps {\n id: string\n value: string\n onChange: (value: string) => void\n /** Called when the person chooses a suggestion, presses Enter, or leaves the field with a changed value. */\n onCommit: (value: string) => void\n suggestions: readonly Suggestion[]\n /** Shown in the list while suggestions load. */\n loading?: boolean\n /** Shown when the list is open but nothing matches. */\n emptyText?: string\n placeholder?: string\n disabled?: boolean\n invalid?: boolean\n describedBy?: string\n 'aria-label'?: string\n}\n\nexport function SuggestInput({ id, value, onChange, onCommit, suggestions, loading = false, emptyText, placeholder,\n disabled = false, invalid = false, describedBy, 'aria-label': ariaLabel }: SuggestInputProps) {\n const [open, setOpen] = useState(false)\n const [active, setActive] = useState(-1)\n const inputRef = useRef<HTMLInputElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n const committed = useRef(value)\n const listId = useId()\n const optionId = (index: number) => `${listId}-option-${index}`\n const showList = open && !disabled && (loading || suggestions.length > 0 || Boolean(emptyText && value.trim()))\n\n useEffect(() => { setActive(-1) }, [suggestions])\n useEffect(() => { if (disabled) setOpen(false) }, [disabled])\n\n function commit(next: string) {\n setOpen(false)\n setActive(-1)\n if (next !== committed.current) {\n committed.current = next\n onCommit(next)\n }\n }\n function choose(index: number) {\n const suggestion = suggestions[index]\n if (!suggestion) return\n onChange(suggestion.value)\n committed.current = ''\n commit(suggestion.value)\n }\n\n return <div className=\"relative min-w-0\">\n <Input ref={inputRef} id={id} size=\"compact\" value={value} disabled={disabled} placeholder={placeholder}\n role=\"combobox\" aria-autocomplete=\"list\" aria-expanded={showList} aria-controls={showList ? listId : undefined}\n aria-activedescendant={showList && active >= 0 ? optionId(active) : undefined}\n aria-invalid={invalid || undefined} aria-describedby={describedBy} aria-label={ariaLabel}\n {...noAutofill}\n onFocus={() => setOpen(true)}\n onChange={event => { onChange(event.target.value); setOpen(true) }}\n onBlur={event => {\n // Choosing a row keeps focus in the field (rows prevent mousedown), so a blur here leaves the control.\n if (panelRef.current?.contains(event.relatedTarget as Node | null)) return\n commit(value.trim())\n }}\n onKeyDown={event => {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n if (!suggestions.length) return\n const step = event.key === 'ArrowDown' ? 1 : -1\n setActive(current => (current + step + suggestions.length) % suggestions.length)\n } else if (event.key === 'Enter') {\n event.preventDefault()\n if (showList && active >= 0) choose(active)\n else commit(value.trim())\n } else if (event.key === 'Escape' && showList) {\n event.preventDefault()\n event.stopPropagation()\n setOpen(false)\n }\n }} />\n <PopoverSurface open={showList} id={listId} role=\"listbox\" aria-label={ariaLabel ?? 'Suggestions'} triggerRef={inputRef} panelRef={panelRef}\n matchTriggerWidth side=\"below\" contentKey={suggestions}\n className={`max-h-72 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 text-foreground ${OVERLAY_SHADOW}`}>\n {loading && <div role=\"status\" className=\"px-3 py-2 text-sm text-muted-foreground\">Loading…</div>}\n {!loading && suggestions.length === 0 && emptyText && <div className=\"px-3 py-2 text-sm text-muted-foreground\">{emptyText}</div>}\n {suggestions.map((suggestion, index) => <div key={suggestion.value} id={optionId(index)} role=\"option\" aria-selected={index === active}\n tabIndex={-1}\n onMouseDown={event => event.preventDefault()}\n onMouseEnter={() => setActive(index)}\n onClick={() => choose(index)}\n className={`flex min-h-9 cursor-pointer flex-col justify-center rounded-md px-3 py-1.5 text-sm ${POPOVER_OPTION_FOCUS} ${index === active ? 'bg-accent' : ''}`}>\n <span className=\"min-w-0 break-words [overflow-wrap:anywhere]\">{suggestion.label}</span>\n {suggestion.detail && <span className=\"min-w-0 break-words text-sm text-muted-foreground [overflow-wrap:anywhere]\">{suggestion.detail}</span>}\n </div>)}\n </PopoverSurface>\n </div>\n}\n","/**\n * MCP servers in the profile: turn each on or off, see whether it answers and\n * which tools it offers, and add or edit a server by its address. Headers,\n * environment, and secret references stay in Advanced JSON.\n *\n * Turning a server off keeps its address in `metadata.enabledConfig`, because\n * the canonical schema does not let a disabled entry carry a URL or command;\n * turning it back on restores that configuration.\n */\nimport { useEffect, useId, useMemo, useRef, useState } from 'react'\nimport type { AgentProfileMcpServer } from '@tangle-network/agent-interface/profile'\nimport { Button, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch } from '@tangle-network/sandbox-ui/primitives'\nimport { publicHttpsUrlProblem, type McpHealth, type ProfileEditorMcpPort } from '../profile-editor'\nimport { Field, fieldMessageId, formRow, formText, noAutofill, StatusPill, type StatusTone } from './agent-profile-form-kit'\nimport type { AgentProfileRegistryPort } from './agent-profile-registry'\nimport { AgentProfileRegistryMcpSearch } from './agent-profile-registry-search'\n\ntype Transport = 'http' | 'sse' | 'stdio'\ntype Servers = Record<string, AgentProfileMcpServer>\n\nconst NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/\n\n/** The configuration a disabled server keeps so it can be turned back on. */\nfunction enabledConfig(server: AgentProfileMcpServer): AgentProfileMcpServer | null {\n if (server.enabled !== false) return server\n const stored = server.metadata?.enabledConfig\n if (!stored || typeof stored !== 'object') return null\n const config = stored as Record<string, unknown>\n if (typeof config.url !== 'string' && typeof config.command !== 'string') return null\n return config as unknown as AgentProfileMcpServer\n}\n\nfunction withoutKeys<T extends object>(value: T, keys: readonly string[]): Record<string, unknown> {\n return Object.fromEntries(Object.entries(value).filter(([key]) => !keys.includes(key)))\n}\n\n/** Disable a server and keep the configuration it needs to come back on. */\nfunction disableMcpServer(server: AgentProfileMcpServer): AgentProfileMcpServer {\n if (server.enabled === false) return server\n const config = withoutKeys(server, ['enabled', 'metadata'])\n return { enabled: false, metadata: { ...(server.metadata ?? {}), enabledConfig: config } }\n}\n\n/** Enable a server from its stored configuration, or null when it has none. */\nfunction enableMcpServer(server: AgentProfileMcpServer): AgentProfileMcpServer | null {\n if (server.enabled !== false) return server\n const config = enabledConfig(server)\n if (!config) return null\n const metadata = withoutKeys(server.metadata ?? {}, ['enabledConfig'])\n return { ...(config as object), ...(Object.keys(metadata).length ? { metadata } : {}) } as AgentProfileMcpServer\n}\n\nfunction serverTransport(server: AgentProfileMcpServer | null): Transport {\n if (!server) return 'http'\n if ('command' in server && server.command) return 'stdio'\n return 'transport' in server && server.transport === 'sse' ? 'sse' : 'http'\n}\n\nfunction serverTarget(server: AgentProfileMcpServer | null): string {\n if (!server) return ''\n if ('command' in server && server.command) return server.command\n return 'url' in server && server.url ? server.url : ''\n}\n\nfunction healthKey(server: AgentProfileMcpServer): string {\n return JSON.stringify(['url' in server ? server.url : null, 'transport' in server ? server.transport : null, 'headers' in server ? server.headers : null])\n}\n\nfunction healthStatus(health: McpHealth | 'checking' | undefined): { tone: StatusTone; label: string } {\n if (health === 'checking') return { tone: 'pending', label: 'Checking' }\n if (!health) return { tone: 'neutral', label: 'Not checked' }\n if (health.ok) return { tone: 'success', label: `Connected · ${health.tools.length} ${health.tools.length === 1 ? 'tool' : 'tools'}` }\n const labels: Record<Exclude<McpHealth, { ok: true }>['problem'], [StatusTone, string]> = {\n 'auth-required': ['warning', 'Needs credentials'],\n 'invalid-url': ['error', 'Invalid address'],\n 'blocked-url': ['error', 'Address not allowed'],\n 'not-checkable': ['neutral', 'Checked at run time'],\n unreachable: ['error', 'Unreachable'],\n timeout: ['error', 'Timed out'],\n 'protocol-error': ['error', 'Not an MCP server'],\n unavailable: ['warning', 'Check unavailable'],\n }\n const [tone, label] = labels[health.problem]\n return { tone, label }\n}\n\nexport interface McpServersEditorProps {\n servers: Servers\n /** Apply the next server map to the profile. Returns false when the profile rejected it. */\n onChange: (next: Servers) => boolean\n port?: ProfileEditorMcpPort\n disabled: boolean\n /** Explain why servers cannot be changed here, for example a missing role. */\n lockReason?: string\n publicHttpsOnly: boolean\n allowLocalCommand: boolean\n registry?: AgentProfileRegistryPort\n /** Report an open add or edit form, so the host can hold its save. */\n onPendingChange?: (pending: boolean) => void\n}\n\ninterface Draft { name: string; transport: Transport; target: string }\n\nfunction targetProblem(draft: Draft, publicHttpsOnly: boolean): string | null {\n const target = draft.target.trim()\n if (!target) return null\n if (draft.transport === 'stdio') return /[\\u0000-\\u001f\\u007f]/.test(target) ? 'Remove control characters from the command.' : null\n if (publicHttpsOnly) return publicHttpsUrlProblem(target)\n try {\n const url = new URL(target)\n return url.protocol === 'https:' || url.protocol === 'http:' ? null : 'Use an http:// or https:// address.'\n } catch { return 'Enter a full URL, such as https://example.com/mcp.' }\n}\n\nfunction serverFromDraft(draft: Draft, previous?: AgentProfileMcpServer): AgentProfileMcpServer {\n const target = draft.target.trim()\n const metadata = previous?.metadata ? withoutKeys(previous.metadata, ['enabledConfig']) : undefined\n const keep = metadata && Object.keys(metadata).length ? { metadata } : {}\n const prior = previous ? enabledConfig(previous) : null\n if (draft.transport === 'stdio') {\n const extras = prior && 'command' in prior ? withoutKeys(prior, ['command', 'transport', 'enabled', 'metadata', 'url', 'headers']) : {}\n return { ...extras, command: target, ...keep } as AgentProfileMcpServer\n }\n const headers = prior && 'headers' in prior && prior.headers ? { headers: prior.headers } : {}\n return { transport: draft.transport, url: target, ...headers, ...keep }\n}\n\nfunction ServerForm({ draft, onDraft, existingNames, nameEditable, publicHttpsOnly, allowLocalCommand, disabled, submitLabel, onSubmit, onCancel }: {\n draft: Draft\n onDraft: (draft: Draft) => void\n existingNames: readonly string[]\n nameEditable: boolean\n publicHttpsOnly: boolean\n allowLocalCommand: boolean\n disabled: boolean\n submitLabel: string\n onSubmit: () => void\n onCancel: () => void\n}) {\n const id = useId()\n const name = draft.name.trim()\n const nameProblem = !nameEditable || !name ? null\n : !NAME_PATTERN.test(name) ? 'Use up to 64 letters, numbers, dots, dashes, or underscores.'\n : existingNames.includes(name) ? 'A server with this name already exists.' : null\n const problem = targetProblem(draft, publicHttpsOnly)\n const ready = !disabled && (!nameEditable || (name && !nameProblem)) && draft.target.trim() && !problem\n return <div className=\"space-y-4 rounded-lg border border-border bg-muted/30 p-4\">\n <div className={formRow}>\n {nameEditable && <Field label=\"Name\" htmlFor={`${id}-name`} error={nameProblem}>\n <Input id={`${id}-name`} size=\"compact\" value={draft.name} disabled={disabled} placeholder=\"search\" {...noAutofill}\n aria-invalid={nameProblem ? true : undefined} aria-describedby={nameProblem ? fieldMessageId(`${id}-name`) : undefined}\n onChange={event => onDraft({ ...draft, name: event.target.value })} />\n </Field>}\n <Field label=\"Connection\" htmlFor={`${id}-transport`}>\n <Select disabled={disabled} value={draft.transport} onValueChange={value => onDraft({ ...draft, transport: value as Transport })}>\n <SelectTrigger id={`${id}-transport`} size=\"compact\" className=\"shadow-none\"><SelectValue /></SelectTrigger>\n <SelectContent>\n <SelectItem value=\"http\">Streamable HTTP</SelectItem>\n <SelectItem value=\"sse\">Server-sent events</SelectItem>\n {(allowLocalCommand || draft.transport === 'stdio') && <SelectItem value=\"stdio\">Local command</SelectItem>}\n </SelectContent>\n </Select>\n </Field>\n </div>\n <Field label={draft.transport === 'stdio' ? 'Command' : 'URL'} htmlFor={`${id}-target`} error={problem}\n hint={draft.transport === 'stdio' ? 'Runs inside the agent workspace.' : undefined}>\n <Input id={`${id}-target`} size=\"compact\" value={draft.target} disabled={disabled} {...noAutofill}\n inputMode={draft.transport === 'stdio' ? 'text' : 'url'}\n placeholder={draft.transport === 'stdio' ? 'npx -y @modelcontextprotocol/server-memory' : 'https://example.com/mcp'}\n aria-invalid={problem ? true : undefined} aria-describedby={fieldMessageId(`${id}-target`)}\n onChange={event => onDraft({ ...draft, target: event.target.value })}\n onKeyDown={event => { if (event.key === 'Enter' && ready) { event.preventDefault(); onSubmit() } }} />\n </Field>\n <div className=\"flex flex-wrap gap-2\">\n <Button type=\"button\" size=\"compact\" disabled={!ready} onClick={onSubmit}>{submitLabel}</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n}\n\nexport function McpServersEditor({ servers, onChange, port, disabled, lockReason, publicHttpsOnly, allowLocalCommand, registry, onPendingChange }: McpServersEditorProps) {\n const [health, setHealth] = useState<Record<string, { key: string; result: McpHealth | 'checking' }>>({})\n const [recheck, setRecheck] = useState<Record<string, number>>({})\n const [editing, setEditing] = useState<{ name: string; draft: Draft; reason?: string } | null>(null)\n const [adding, setAdding] = useState<Draft | null>(null)\n const controllers = useRef(new Map<string, AbortController>())\n const locked = lockReason !== undefined\n const entries = useMemo(() => Object.entries(servers), [servers])\n\n // Check every enabled remote server once per configuration, and again on request.\n useEffect(() => {\n if (!port) return\n for (const [name, server] of entries) {\n if (server.enabled === false || ('command' in server && server.command)) continue\n const key = `${healthKey(server)}#${recheck[name] ?? 0}`\n if (health[name]?.key === key) continue\n controllers.current.get(name)?.abort()\n const controller = new AbortController()\n controllers.current.set(name, controller)\n setHealth(current => ({ ...current, [name]: { key, result: 'checking' } }))\n port.check(server, controller.signal).then(result => {\n if (!controller.signal.aborted) setHealth(current => ({ ...current, [name]: { key, result } }))\n }, () => {\n if (!controller.signal.aborted) {\n setHealth(current => ({ ...current, [name]: { key, result: { ok: false, problem: 'unavailable', message: 'The check could not run.', checkedAt: new Date().toISOString() } } }))\n }\n })\n }\n }, [entries, port, recheck, health])\n useEffect(() => () => { for (const controller of controllers.current.values()) controller.abort() }, [])\n const pending = editing !== null || adding !== null\n useEffect(() => { onPendingChange?.(pending) }, [pending, onPendingChange])\n\n function setServer(name: string, server: AgentProfileMcpServer | null) {\n const next = { ...servers }\n if (server) next[name] = server\n else delete next[name]\n return onChange(next)\n }\n\n function toggle(name: string, server: AgentProfileMcpServer, on: boolean) {\n if (!on) { setServer(name, disableMcpServer(server)); return }\n const enabled = enableMcpServer(server)\n if (enabled) { setServer(name, enabled); return }\n setEditing({ name, draft: { name, transport: 'http', target: '' }, reason: 'Add the server address to turn it on.' })\n }\n\n return <div className=\"space-y-4\">\n {entries.length === 0 && <p className={formText.muted}>No MCP servers yet.</p>}\n {entries.length > 0 && <ul className=\"divide-y divide-border rounded-lg border border-border\">\n {entries.map(([name, server]) => {\n const on = server.enabled !== false\n const config = enabledConfig(server)\n const local = serverTransport(config) === 'stdio'\n const target = serverTarget(config)\n const result = health[name]?.result\n const status = !on ? { tone: 'neutral' as const, label: 'Off' }\n : local ? { tone: 'neutral' as const, label: 'Checked at run time' }\n : port ? healthStatus(result) : { tone: 'neutral' as const, label: 'Not checked' }\n const description = typeof server.metadata?.description === 'string' ? server.metadata.description : null\n const policyProblem = on && !local && publicHttpsOnly && target ? publicHttpsUrlProblem(target) : null\n const toggleId = `mcp-${name}-toggle`\n return <li key={name} className=\"space-y-3 p-3\" aria-label={`MCP server ${name}`}>\n <div className=\"flex items-start gap-3\">\n <span className=\"flex h-6 items-center\">\n <Switch id={toggleId} checked={on} disabled={disabled || locked} aria-label={`${on ? 'Turn off' : 'Turn on'} ${name}`}\n title={lockReason} onCheckedChange={checked => toggle(name, server, checked)} />\n </span>\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex flex-wrap items-center justify-between gap-x-3\">\n <label htmlFor={toggleId} className={`min-w-0 break-words ${formText.label}`}>{name}</label>\n <StatusPill tone={status.tone}>{status.label}</StatusPill>\n </div>\n <p className={`truncate ${formText.muted}`} title={target || undefined}>{target || 'No address yet'}</p>\n {description && <p className={formText.muted}>{description}</p>}\n {policyProblem && <p className={formText.error}>{policyProblem}</p>}\n {on && !local && result && result !== 'checking' && !result.ok && result.problem !== 'not-checkable' &&\n <p className={result.problem === 'auth-required' || result.problem === 'unavailable' ? formText.muted : formText.error}>{result.message}</p>}\n {on && result && result !== 'checking' && result.ok && result.tools.length > 0 &&\n <p className={`line-clamp-2 ${formText.muted}`}>Tools: {result.tools.map(tool => tool.name).join(', ')}</p>}\n </div>\n </div>\n {!locked && <div className=\"flex flex-wrap gap-1 pl-9\">\n {port && on && !local && <Button type=\"button\" size=\"compact\" variant=\"ghost\" disabled={disabled || result === 'checking'}\n onClick={() => setRecheck(current => ({ ...current, [name]: (current[name] ?? 0) + 1 }))}>Check again</Button>}\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" disabled={disabled} aria-label={`Edit ${name}`}\n onClick={() => setEditing({ name, draft: { name, transport: serverTransport(config), target } })}>Edit</Button>\n <Button type=\"button\" size=\"compact\" variant=\"ghost\" className=\"text-destructive hover:text-destructive\" disabled={disabled}\n aria-label={`Remove ${name}`} onClick={() => { if (setServer(name, null) && editing?.name === name) setEditing(null) }}>Remove</Button>\n </div>}\n {editing?.name === name && <div className=\"space-y-2 @lg/profile-editor:pl-12\">\n {editing.reason && <p className={formText.muted}>{editing.reason}</p>}\n <ServerForm draft={editing.draft} onDraft={draft => setEditing({ ...editing, draft })} existingNames={[]} nameEditable={false}\n publicHttpsOnly={publicHttpsOnly} allowLocalCommand={allowLocalCommand} disabled={disabled} submitLabel=\"Save\"\n onCancel={() => setEditing(null)}\n onSubmit={() => { if (setServer(name, serverFromDraft(editing.draft, server))) setEditing(null) }} />\n </div>}\n </li>\n })}\n </ul>}\n {locked && <p className={formText.muted}>{lockReason}</p>}\n {!locked && (adding\n ? <ServerForm draft={adding} onDraft={setAdding} existingNames={Object.keys(servers)} nameEditable publicHttpsOnly={publicHttpsOnly}\n allowLocalCommand={allowLocalCommand} disabled={disabled} submitLabel=\"Add server\" onCancel={() => setAdding(null)}\n onSubmit={() => { if (setServer(adding.name.trim(), serverFromDraft(adding))) setAdding(null) }} />\n : <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={disabled} onClick={() => setAdding({ name: '', transport: 'http', target: '' })}>Add server</Button>)}\n {registry && !locked && <AgentProfileRegistryMcpSearch registry={registry} disabled={disabled} existingNames={Object.keys(servers)}\n validate={(name, server) => {\n if (!name.trim()) return 'The registry returned a server without a usable name.'\n if (name in servers) return 'A server with that name already exists.'\n return publicHttpsOnly && 'url' in server && server.url ? publicHttpsUrlProblem(server.url)\n : publicHttpsOnly ? 'Use a public HTTPS MCP endpoint.' : null\n }}\n onAdd={(name, server) => setServer(name, server)} />}\n <p className={formText.muted}>Headers, environment variables, and secret references are edited in Advanced JSON.</p>\n </div>\n}\n","/**\n * Drop or choose text files to add to the profile as resource files. Each file\n * is read in the browser and stored inline, with per-file progress and a clear\n * reason for any file that is refused (type, size, count, encoding, or a path\n * already in use). The drop target and the progress list are the shared\n * `SidebarDropZone` and `UploadProgress` primitives.\n */\nimport { useRef, useState, type ReactNode } from 'react'\nimport { Button } from '@tangle-network/sandbox-ui/primitives'\nimport { SidebarDropZone, UploadProgress, type UploadFile } from '@tangle-network/ui/primitives'\nimport { filterAcceptedFiles } from './composer-file-accept'\nimport { formText } from './agent-profile-form-kit'\n\nexport interface ResourceFileLimits {\n /** Accepted types, in `<input accept>` grammar. Defaults to Markdown, text, and JSON. */\n accept?: readonly string[]\n /** Largest file in bytes. Defaults to 256 KiB. */\n maxFileBytes?: number\n /** Most resource files in the profile. Defaults to 50. */\n maxFiles?: number\n}\n\nconst DEFAULT_RESOURCE_FILE_ACCEPT = ['.md', '.markdown', '.txt', '.json', '.yaml', '.yml', '.csv'] as const\n\ninterface ReadFile {\n name: string\n content: string\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`\n if (bytes < 1024 * 1024) return `${Math.max(1, Math.round(bytes / 1024))} KB`\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\n/** A file name safe to use as one path segment. */\nfunction safeFileName(name: string): string {\n const base = name.split(/[\\\\/]/).pop() ?? name\n return base.normalize('NFKC').replace(/[\\u0000-\\u001f\\u007f]/g, '').replace(/\\s+/g, '-').replace(/[^A-Za-z0-9._-]/g, '').replace(/^\\.+/, '') || 'file'\n}\n\nfunction readText(file: File, onProgress: (percent: number) => void): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onprogress = event => { if (event.lengthComputable) onProgress(Math.round((event.loaded / event.total) * 100)) }\n reader.onerror = () => reject(new Error('The browser could not read this file.'))\n reader.onload = () => {\n const buffer = reader.result\n if (!(buffer instanceof ArrayBuffer)) { reject(new Error('The browser could not read this file.')); return }\n try { resolve(new TextDecoder('utf-8', { fatal: true }).decode(buffer)) } catch {\n reject(new Error('This is not a text file. Upload UTF-8 text, Markdown, or JSON.'))\n }\n }\n reader.readAsArrayBuffer(file)\n })\n}\n\nexport interface ResourceFileDropProps {\n /** Paths already in the profile, for conflict checks. */\n existingPaths: readonly string[]\n /** Folder new files land in, for example `reference/`. */\n pathPrefix?: string\n limits?: ResourceFileLimits\n disabled?: boolean\n /** Add the read files. Returns the reason the profile rejected them, or null. */\n onAdd: (files: { path: string; file: ReadFile }[]) => string | null\n /** More add actions shown beside \"Choose files\". */\n actions?: ReactNode\n}\n\n/** The drop target, file chooser, and progress list for resource files. */\nexport function ResourceFileDrop({ existingPaths, pathPrefix = '', limits, disabled = false, onAdd, actions }: ResourceFileDropProps) {\n const [uploads, setUploads] = useState<UploadFile[]>([])\n const input = useRef<HTMLInputElement>(null)\n const accept = (limits?.accept ?? DEFAULT_RESOURCE_FILE_ACCEPT).join(',')\n const maxFileBytes = limits?.maxFileBytes ?? 256 * 1024\n const maxFiles = limits?.maxFiles ?? 50\n const types = (limits?.accept ?? DEFAULT_RESOURCE_FILE_ACCEPT).map(type => type.replace(/^\\./, '').toUpperCase())\n const typeList = types.length > 1 ? `${types.slice(0, -1).join(', ')} or ${types[types.length - 1]}` : types[0]\n\n function update(id: string, change: Partial<UploadFile>) {\n setUploads(current => current.map(item => item.id === id ? { ...item, ...change } : item))\n }\n\n async function receive(list: File[] | FileList) {\n if (disabled) return\n const files = Array.from(list)\n if (!files.length) return\n const { rejected } = filterAcceptedFiles(files, accept)\n const batch: UploadFile[] = []\n const taken = new Set(existingPaths)\n let room = maxFiles - existingPaths.length\n const work: { id: string; file: File; path: string }[] = []\n for (const file of files) {\n const id = `${Date.now()}-${Math.random().toString(36).slice(2)}`\n const base: UploadFile = { id, name: file.name, size: file.size, status: 'pending' }\n const path = pathPrefix + safeFileName(file.name)\n let error: string | null = null\n if (rejected.some(item => item.file === file)) error = `Only ${typeList} files can be added.`\n else if (file.size > maxFileBytes) error = `This file is ${formatBytes(file.size)}. Files can be up to ${formatBytes(maxFileBytes)}.`\n else if (file.size === 0) error = 'This file is empty.'\n else if (taken.has(path)) error = `${path} is already in the profile. Remove it first or rename the file.`\n else if (room <= 0) error = `The profile can hold ${maxFiles} files. Remove one to add another.`\n if (error) { batch.push({ ...base, status: 'error', error }); continue }\n taken.add(path)\n room--\n batch.push(base)\n work.push({ id, file, path })\n }\n setUploads(current => [...current.filter(item => item.status !== 'complete'), ...batch])\n const read: { id: string; path: string; file: ReadFile }[] = []\n for (const item of work) {\n update(item.id, { status: 'uploading', progress: 0 })\n try {\n const content = await readText(item.file, progress => update(item.id, { progress }))\n read.push({ id: item.id, path: item.path, file: { name: safeFileName(item.file.name), content } })\n update(item.id, { progress: 100 })\n } catch (cause) {\n update(item.id, { status: 'error', error: cause instanceof Error ? cause.message : 'The file could not be read.' })\n }\n }\n if (!read.length) return\n const refused = onAdd(read.map(({ path, file }) => ({ path, file })))\n for (const item of read) {\n update(item.id, refused ? { status: 'error', error: refused } : { status: 'complete', progress: 100 })\n }\n }\n\n return <div className=\"space-y-3\">\n <SidebarDropZone persistent disabled={disabled} onDrop={files => void receive(files)}\n title=\"Drop files here\"\n description={`${typeList} up to ${formatBytes(maxFileBytes)} each`}\n // The primitive's own copy is 12px and 10px; the form uses one 14px size.\n className=\"[&_p]:text-sm [&_p]:leading-6 focus-within:border-[var(--focus-border)]\" />\n <div className=\"flex flex-wrap items-center gap-2\">\n <Button type=\"button\" size=\"compact\" variant=\"outline\" disabled={disabled} onClick={() => input.current?.click()}>Choose files</Button>\n {actions}\n <input ref={input} type=\"file\" multiple accept={accept} className=\"sr-only\" tabIndex={-1} aria-hidden=\"true\"\n onChange={event => { const files = event.target.files; if (files) void receive(files); event.target.value = '' }} />\n {uploads.length > 0 && <Button type=\"button\" size=\"compact\" variant=\"ghost\" onClick={() => setUploads([])}>Clear list</Button>}\n </div>\n {uploads.length > 0 && <div aria-live=\"polite\">\n <UploadProgress files={uploads} onRemove={id => setUploads(current => current.filter(item => item.id !== id))}\n // The primitive sets size and error text at 12px; keep them at the form's 14px.\n className=\"[&_.text-xs]:text-sm\" />\n </div>}\n {uploads.some(item => item.status === 'error') && <p className={formText.muted}>Files with an error were not added.</p>}\n </div>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAAA,YAAW,SAAAC,QAAO,WAAAC,UAAS,YAAAC,iBAAgC;AAEpE,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,UAAAC,SAAQ,SAAAC,QAAO,UAAU,UAAAC,SAAQ,UAAAC,SAAQ,iBAAAC,gBAAe,cAAAC,aAAY,iBAAAC,gBAAe,eAAAC,oBAAmB;AAC/G,SAAS,uBAAuB;;;ACNhC,SAAS,QAAQ,gBAAgB;AAEjC,SAAS,QAAQ,aAAa;;;ACkDvB,IAAM,4BAAN,cAAwC,MAAM;AAAA,EACnD,YAAqB,MAAmC,SAAiB;AACvE,U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AO,MAAM,CAAC,CAAC;AAAG,2BAAa,KAAK;AAAG,uBAAS,IAAI;AAAA,YAAE;AAAA,YAAG;AAAA;AAAA,QAAkB;AAAA,SACvH;AAAA,MACA,gBAAAR,KAAC,OAAE,WAAW,SAAS,OAAO,oFAAsE;AAAA,OACtG;AAAA,KACF,GACF;AACF;AAEA,SAAS,eAAe,EAAE,OAAO,IAAI,OAAO,QAAQ,UAAU,UAAU,MAAM,GAQ3E;AACD,QAAM,YAAY,QAAQ,SAAS,SAAS,MAAM,IAAI,IAAI;AAG1D,EAAAI,WAAU,MAAM;AAAE,QAAI,aAAa,CAAC,MAAO,UAAS,SAAS;AAAA,EAAE,GAAG,CAAC,SAAS,CAAC;AAC7E,SAAO,gBAAAJ,KAAC,SAAM,OAAM,kBAAiB,SAAS,IAAI,OAAO,OAAO,MAAM,CAAC,SAAS,SAAS,kBAAkB,MAAM,KAAK,QACpH,0BAAAA;AAAA,IAACM;AAAA,IAAA;AAAA,MAAM;AAAA,MAAQ,MAAK;AAAA,MAAU;AAAA,MAAc,UAAU,YAAY,CAAC;AAAA,MAAO,aAAa,SAAS;AAAA,MAAa,GAAG;AAAA,MAC9G,gBAAc,QAAQ,OAAO;AAAA,MAAW,oBAAkB,eAAe,EAAE;AAAA,MAAG,UAAU,WAAS,SAAS,MAAM,OAAO,KAAK;AAAA;AAAA,EAAG,GACnI;AACF;","names":["useEffect","useId","useMemo","useState","Button","Input","Switch","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","useState","jsx","jsxs","useEffect","useId","useRef","useState","Button","Input","useId","useRef","useState","Input","jsx","jsxs","useState","useRef","useId","Input","Fragment","jsx","jsxs","useState","useRef","useEffect","useId","Button","Input","useEffect","useId","useMemo","useRef","useState","Button","Input","jsx","jsxs","useId","Input","Button","useState","useRef","useMemo","useEffect","useRef","useState","Button","jsx","jsxs","useState","useRef","Button","Fragment","jsx","jsxs","useId","useState","useEffect","useMemo","Input","Switch","Button","rowActions","Select","SelectTrigger","SelectValue","SelectContent","SelectItem"]}
|