@tangle-network/agent-app 0.58.14 → 0.58.16
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/VaultPane-RIJM452Y.js +7 -0
- package/dist/agent-profiles/d1.js +4 -1
- package/dist/agent-profiles/d1.js.map +1 -1
- package/dist/agent-profiles/index.d.ts +1 -1
- package/dist/agent-profiles/index.js +10 -1
- package/dist/agent-profiles/self-management.d.ts +77 -0
- package/dist/assistant/index.js +13 -11
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-react/index.js +4 -4
- package/dist/chat-routes/index.js +7 -7
- package/dist/chat-store/index.js +2 -2
- package/dist/{chunk-W5VBZTNN.js → chunk-4ZMZDE24.js} +9 -9
- package/dist/chunk-B7CL7ENS.js +118 -0
- package/dist/chunk-B7CL7ENS.js.map +1 -0
- package/dist/{chunk-KU3XTB7O.js → chunk-BDCATWBV.js} +3 -3
- package/dist/{chunk-NWR5CERQ.js → chunk-FNRUXPXE.js} +2 -2
- package/dist/{chunk-FZCXV4NH.js → chunk-GEGCSRYQ.js} +2 -2
- package/dist/{chunk-WTGSLW5X.js → chunk-HTAFI247.js} +4 -4
- package/dist/{chunk-YEBSFADG.js → chunk-IBTM5SAZ.js} +121 -1
- package/dist/chunk-IBTM5SAZ.js.map +1 -0
- package/dist/{chunk-Y2TP52AB.js → chunk-KSLVMA2D.js} +3 -3
- package/dist/{chunk-SPLPFIWT.js → chunk-OFQUM5FP.js} +52 -15
- package/dist/chunk-OFQUM5FP.js.map +1 -0
- package/dist/chunk-PV33JZKV.js +115 -0
- package/dist/chunk-PV33JZKV.js.map +1 -0
- package/dist/{chunk-WN24GJ7A.js → chunk-Q3BLSWYP.js} +2 -2
- package/dist/{chunk-LLHHZHQC.js → chunk-S5MKEU2E.js} +2607 -1438
- package/dist/chunk-S5MKEU2E.js.map +1 -0
- package/dist/{chunk-EN5CP7T7.js → chunk-T5PPQPOD.js} +5 -111
- package/dist/chunk-T5PPQPOD.js.map +1 -0
- package/dist/{chunk-DWUBICLW.js → chunk-UGPV7VEW.js} +569 -236
- package/dist/chunk-UGPV7VEW.js.map +1 -0
- package/dist/{chunk-52PYOFI6.js → chunk-XOBVWCOA.js} +348 -312
- package/dist/chunk-XOBVWCOA.js.map +1 -0
- package/dist/{mention-editor-BPDSMGJI.js → mention-editor-4D32JTDS.js} +2 -2
- package/dist/preset-cloudflare/index.js +3 -3
- package/dist/profile/index.js +4 -2
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/index.d.ts +185 -0
- package/dist/profile-editor/index.js +18 -0
- package/dist/profile-editor/index.js.map +1 -0
- package/dist/profile-editor/server.d.ts +112 -0
- package/dist/profile-editor/server.js +635 -0
- package/dist/profile-editor/server.js.map +1 -0
- package/dist/public-consultation/index.js +4 -4
- package/dist/sandbox/index.js +3 -3
- package/dist/skills/frontmatter.d.ts +43 -0
- package/dist/skills/index.d.ts +1 -38
- package/dist/skills/index.js +4 -2
- package/dist/skills-placement/index.js +2 -1
- package/dist/skills-placement/index.js.map +1 -1
- package/dist/stories/fixtures/profile-editor.d.ts +17 -0
- package/dist/studio-react/index.js +3 -3
- package/dist/teams/invitations-api.js +3 -3
- package/dist/tools/index.js +3 -3
- package/dist/vault/VaultPane.d.ts +4 -4
- package/dist/vault/VaultTree.d.ts +39 -0
- package/dist/vault/contracts.d.ts +17 -7
- package/dist/vault/index.d.ts +5 -4
- package/dist/vault/index.js +7 -3
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +63 -1
- package/dist/web-react/agent-profile-files.d.ts +38 -0
- package/dist/web-react/agent-profile-form-kit.d.ts +87 -0
- package/dist/web-react/agent-profile-github-source.d.ts +35 -0
- package/dist/web-react/agent-profile-mcp-servers.d.ts +20 -0
- package/dist/web-react/agent-profile-suggest-input.d.ts +31 -0
- package/dist/web-react/agent-session-controls.d.ts +51 -0
- package/dist/web-react/controls.d.ts +31 -6
- package/dist/web-react/index.d.ts +3 -2
- package/dist/web-react/index.js +23 -15
- package/dist/workspace-react/index.js +4 -4
- package/package.json +11 -1
- package/dist/VaultPane-SPXE7XAC.js +0 -7
- package/dist/chunk-52PYOFI6.js.map +0 -1
- package/dist/chunk-DWUBICLW.js.map +0 -1
- package/dist/chunk-EN5CP7T7.js.map +0 -1
- package/dist/chunk-LLHHZHQC.js.map +0 -1
- package/dist/chunk-SPLPFIWT.js.map +0 -1
- package/dist/chunk-YEBSFADG.js.map +0 -1
- /package/dist/{VaultPane-SPXE7XAC.js.map → VaultPane-RIJM452Y.js.map} +0 -0
- /package/dist/{chunk-W5VBZTNN.js.map → chunk-4ZMZDE24.js.map} +0 -0
- /package/dist/{chunk-KU3XTB7O.js.map → chunk-BDCATWBV.js.map} +0 -0
- /package/dist/{chunk-NWR5CERQ.js.map → chunk-FNRUXPXE.js.map} +0 -0
- /package/dist/{chunk-FZCXV4NH.js.map → chunk-GEGCSRYQ.js.map} +0 -0
- /package/dist/{chunk-WTGSLW5X.js.map → chunk-HTAFI247.js.map} +0 -0
- /package/dist/{chunk-Y2TP52AB.js.map → chunk-KSLVMA2D.js.map} +0 -0
- /package/dist/{chunk-WN24GJ7A.js.map → chunk-Q3BLSWYP.js.map} +0 -0
- /package/dist/{mention-editor-BPDSMGJI.js.map → mention-editor-4D32JTDS.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/profile-editor/server.ts"],"sourcesContent":["/**\n * Server side of the profile editor's source checks. The product route\n * authenticates the caller, authorizes the workspace, and supplies the\n * transport: a {@link GitHubSourceReader} bound to the workspace's GitHub\n * connection and the address policy for MCP checks. Everything here is\n * fetch-based and runs in Workers and Node.\n */\nimport { z } from 'zod'\nimport type { AgentProfileConfigValue, AgentProfileMcpServer } from '@tangle-network/agent-interface/profile'\nimport {\n isCommitSha, PROFILE_EDITOR_ROUTES, publicHttpsUrlProblem, readSkillFrontmatter,\n type GitHubCommitSummary, type GitHubFileList, type GitHubRepositorySummary, type GitHubSourceCheck,\n type GitHubSourceFailure, type GitHubSourceOutcome, type GitHubSourceProblem, type GitHubSourceRequest,\n type McpHealth, type McpTool, type ProfileEditorGitHubPort, type ProfileEditorMcpPort,\n} from './index'\n\nexport * from './index'\n\n// ── GitHub ──────────────────────────────────────────────────────────────────\n\n/**\n * A GitHub read failure. `status` is the HTTP status GitHub returned, or\n * `not-connected` when the workspace has no usable connection, or\n * `unsupported` when the transport cannot perform the operation.\n */\nexport class GitHubReadError extends Error {\n constructor(readonly status: number | 'not-connected' | 'unsupported', message: string, readonly rateLimited = false) {\n super(message)\n this.name = 'GitHubReadError'\n }\n}\n\nexport interface GitHubRepositoryRecord {\n fullName: string\n private: boolean\n defaultBranch: string\n description?: string | null\n}\n\nexport interface GitHubCommitRecord {\n sha: string\n treeSha: string\n committedAt?: string\n message?: string\n}\n\nexport interface GitHubTreeRecord {\n entries: { path: string; type: 'blob' | 'tree' | 'commit'; sha: string; size?: number }[]\n truncated: boolean\n}\n\n/**\n * The GitHub operations the source service needs. Implementations throw\n * {@link GitHubReadError} for GitHub refusals so the service can explain them.\n */\nexport interface GitHubSourceReader {\n /** Repositories the credential can read, most recently pushed first. Omit when the transport cannot list them. */\n listRepositories?(signal?: AbortSignal): Promise<GitHubRepositoryRecord[]>\n getRepository(owner: string, repo: string, signal?: AbortSignal): Promise<GitHubRepositoryRecord>\n getBranchHead(owner: string, repo: string, branch: string, signal?: AbortSignal): Promise<GitHubCommitRecord>\n /** Resolve a full commit SHA, throwing a 404 or 422 when it is absent. */\n getCommit(owner: string, repo: string, sha: string, signal?: AbortSignal): Promise<GitHubCommitRecord>\n /** The recursive tree of a commit or tree SHA. */\n getTree(owner: string, repo: string, sha: string, signal?: AbortSignal): Promise<GitHubTreeRecord>\n /** A blob's bytes. */\n getBlob(owner: string, repo: string, sha: string, signal?: AbortSignal): Promise<Uint8Array>\n}\n\nexport interface GitHubRestReaderOptions {\n /** A token for the person or installation. Without one, only public repositories resolve and listing is unavailable. */\n token?: string\n fetch?: typeof fetch\n baseUrl?: string\n timeoutMs?: number\n}\n\nfunction decodeBase64(text: string): Uint8Array {\n const binary = atob(text.replace(/\\s+/g, ''))\n const bytes = new Uint8Array(binary.length)\n for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index)\n return bytes\n}\n\n/** Parse GitHub REST payloads shared by the REST reader and other transports that relay GitHub's JSON. */\nexport const githubPayload = {\n repository(value: unknown): GitHubRepositoryRecord {\n const body = z.object({ full_name: z.string(), private: z.boolean(), default_branch: z.string(), description: z.string().nullish() }).parse(value)\n return { fullName: body.full_name, private: body.private, defaultBranch: body.default_branch, description: body.description }\n },\n repositories(value: unknown): GitHubRepositoryRecord[] {\n return z.array(z.unknown()).parse(value).map(item => githubPayload.repository(item))\n },\n branch(value: unknown): GitHubCommitRecord {\n const body = z.object({ commit: z.object({ sha: z.string(), commit: z.object({\n tree: z.object({ sha: z.string() }), message: z.string().optional(),\n committer: z.object({ date: z.string().optional() }).nullish(),\n }) }) }).parse(value)\n return { sha: body.commit.sha, treeSha: body.commit.commit.tree.sha, committedAt: body.commit.commit.committer?.date,\n message: body.commit.commit.message }\n },\n commit(value: unknown): GitHubCommitRecord {\n const body = z.object({ sha: z.string(), commit: z.object({\n tree: z.object({ sha: z.string() }), message: z.string().optional(),\n committer: z.object({ date: z.string().optional() }).nullish(),\n }) }).parse(value)\n return { sha: body.sha, treeSha: body.commit.tree.sha, committedAt: body.commit.committer?.date, message: body.commit.message }\n },\n tree(value: unknown): GitHubTreeRecord {\n const body = z.object({ truncated: z.boolean().optional(), tree: z.array(z.object({\n path: z.string(), type: z.enum(['blob', 'tree', 'commit']), sha: z.string(), size: z.number().optional(),\n })) }).parse(value)\n return { entries: body.tree, truncated: body.truncated === true }\n },\n blob(value: unknown): Uint8Array {\n const body = z.object({ content: z.string(), encoding: z.string() }).parse(value)\n if (body.encoding === 'base64') return decodeBase64(body.content)\n if (body.encoding === 'utf-8') return new TextEncoder().encode(body.content)\n throw new GitHubReadError(415, `GitHub returned the file in an unsupported encoding (${body.encoding}).`)\n },\n}\n\n/** A reader over GitHub's REST API with a person or installation token. */\nexport function createGitHubRestReader(options: GitHubRestReaderOptions = {}): GitHubSourceReader {\n const base = (options.baseUrl ?? 'https://api.github.com').replace(/\\/+$/, '')\n const send = options.fetch ?? ((input: RequestInfo | URL, init?: RequestInit) => globalThis.fetch(input, init))\n const segment = encodeURIComponent\n async function get(path: string, signal?: AbortSignal): Promise<unknown> {\n const timeout = AbortSignal.timeout(options.timeoutMs ?? 10_000)\n const response = await send(base + path, {\n redirect: 'follow',\n signal: signal ? AbortSignal.any([signal, timeout]) : timeout,\n headers: {\n Accept: 'application/vnd.github+json', 'X-GitHub-Api-Version': '2022-11-28', 'User-Agent': 'tangle-agent-app',\n ...(options.token ? { Authorization: `Bearer ${options.token}` } : {}),\n },\n })\n if (!response.ok) {\n const rateLimited = response.status === 429 || (response.status === 403 && response.headers.get('x-ratelimit-remaining') === '0')\n const detail = await response.json().then(body => (body as { message?: string }).message ?? '').catch(() => '')\n throw new GitHubReadError(response.status, detail || `GitHub answered HTTP ${response.status}`, rateLimited)\n }\n return response.json()\n }\n return {\n ...(options.token ? { listRepositories: async (signal?: AbortSignal) =>\n githubPayload.repositories(await get('/user/repos?per_page=100&sort=pushed', signal)) } : {}),\n getRepository: async (owner, repo, signal) => githubPayload.repository(await get(`/repos/${segment(owner)}/${segment(repo)}`, signal)),\n getBranchHead: async (owner, repo, branch, signal) =>\n githubPayload.branch(await get(`/repos/${segment(owner)}/${segment(repo)}/branches/${branch.split('/').map(segment).join('/')}`, signal)),\n getCommit: async (owner, repo, sha, signal) => githubPayload.commit(await get(`/repos/${segment(owner)}/${segment(repo)}/commits/${segment(sha)}`, signal)),\n getTree: async (owner, repo, sha, signal) => githubPayload.tree(await get(`/repos/${segment(owner)}/${segment(repo)}/git/trees/${segment(sha)}?recursive=1`, signal)),\n getBlob: async (owner, repo, sha, signal) => githubPayload.blob(await get(`/repos/${segment(owner)}/${segment(repo)}/git/blobs/${segment(sha)}`, signal)),\n }\n}\n\nexport interface GitHubSourceServiceOptions {\n /** Largest file the product stores or fetches, in bytes. Defaults to 256 KiB. */\n maxFileBytes?: number\n /** Most paths returned for suggestions. Defaults to 5,000. */\n maxFiles?: number\n}\n\nconst fail = (problem: GitHubSourceProblem, message: string): GitHubSourceFailure => ({ ok: false, problem, message })\n\nfunction splitRepository(repository: string): [string, string] | null {\n const [owner, repo, ...rest] = repository.split('/')\n if (!owner || !repo || rest.length || !/^[A-Za-z0-9_.-]{1,100}$/.test(owner) || !/^[A-Za-z0-9_.-]{1,100}$/.test(repo)) return null\n if (owner === '.' || owner === '..' || repo === '.' || repo === '..') return null\n return [owner, repo]\n}\n\nfunction normalizedRepositoryPath(path: string): string | null {\n const trimmed = path.trim().replace(/^\\.\\/+/, '').replace(/\\/+$/, '')\n if (!trimmed || trimmed.length > 400 || trimmed.startsWith('/') || trimmed.includes('\\\\') || /[\\u0000-\\u001f\\u007f]/.test(trimmed)) return null\n return trimmed.split('/').every(part => part && part !== '.' && part !== '..') ? trimmed : null\n}\n\nfunction summary(record: GitHubRepositoryRecord): GitHubRepositorySummary {\n return { fullName: record.fullName, private: record.private, defaultBranch: record.defaultBranch,\n ...(record.description ? { description: record.description } : {}) }\n}\n\nfunction commitSummary(record: GitHubCommitRecord, branch?: string): GitHubCommitSummary {\n return { sha: record.sha, ...(branch ? { branch } : {}), ...(record.committedAt ? { committedAt: record.committedAt } : {}),\n ...(record.message ? { message: record.message.split('\\n')[0] } : {}) }\n}\n\n/** Explain a reader failure in the context of the step that failed. */\nfunction readFailure(error: unknown, step: 'list' | 'repository' | 'commit' | 'file', repository = ''): GitHubSourceFailure {\n if (!(error instanceof GitHubReadError)) {\n const timedOut = error instanceof Error && (error.name === 'TimeoutError' || error.name === 'AbortError')\n return fail('unavailable', timedOut ? 'GitHub did not answer in time. Try again.' : 'GitHub could not be reached. Try again.')\n }\n if (error.status === 'not-connected') return fail('not-connected', 'Connect GitHub to this workspace to use its repositories.')\n if (error.status === 'unsupported') {\n return fail('unavailable', step === 'list'\n ? 'Repository search is not available for this GitHub connection. Type owner/repo instead.'\n : 'This GitHub connection cannot read repository contents.')\n }\n if (error.rateLimited || error.status === 429) return fail('rate-limited', 'GitHub is rate limiting this connection. Try again in a minute.')\n if (error.status === 401) return fail('no-access', 'GitHub rejected this connection. Reconnect GitHub and try again.')\n if (error.status === 403) {\n return fail('no-access', repository\n ? `Your GitHub connection is not allowed to read ${repository}. Grant it access, or authorize it for the organization's SSO.`\n : 'GitHub refused this connection. Reconnect GitHub and try again.')\n }\n if (error.status === 404 && step === 'repository') {\n return fail('repository-not-found', `No repository named ${repository} is visible to your GitHub connection. Check the name, or give the connection access to it.`)\n }\n if ((error.status === 404 || error.status === 422) && step === 'commit') return fail('ref-not-found', `That commit is not in ${repository}.`)\n if (error.status === 409) return fail('ref-not-found', `${repository} has no commits yet.`)\n if (error.status === 404 && step === 'file') return fail('path-not-found', 'That file is not in the selected commit.')\n return fail('unavailable', `GitHub could not complete the request (HTTP ${error.status}). Try again.`)\n}\n\n/** Decode UTF-8 text, or null for binary content. */\nfunction utf8(bytes: Uint8Array): string | null {\n try { return new TextDecoder('utf-8', { fatal: true }).decode(bytes) } catch { return null }\n}\n\n/**\n * The editor's GitHub port, computed from a reader. Lookups are typed\n * outcomes; nothing here throws for a GitHub refusal.\n */\nexport function createGitHubSourceService(reader: GitHubSourceReader, options: GitHubSourceServiceOptions = {}): ProfileEditorGitHubPort {\n const maxFileBytes = options.maxFileBytes ?? 256 * 1024\n const maxFiles = options.maxFiles ?? 5_000\n const invalidRepository = fail('repository-not-found', 'Enter a repository as owner/repo.')\n\n async function resolveCommit(owner: string, repo: string, sha: string, signal?: AbortSignal): Promise<GitHubSourceOutcome<GitHubCommitRecord>> {\n if (!isCommitSha(sha)) return fail('ref-not-found', 'Enter the full 40-character commit SHA.')\n try { return { ok: true, value: await reader.getCommit(owner, repo, sha.toLowerCase(), signal) } } catch (error) {\n if (error instanceof GitHubReadError && error.status === 404) {\n // A 404 on the commit can also mean the repository itself is missing.\n try { await reader.getRepository(owner, repo, signal) } catch (repositoryError) {\n return readFailure(repositoryError, 'repository', `${owner}/${repo}`)\n }\n }\n return readFailure(error, 'commit', `${owner}/${repo}`)\n }\n }\n\n async function tree(owner: string, repo: string, record: GitHubCommitRecord, signal?: AbortSignal): Promise<GitHubSourceOutcome<GitHubTreeRecord>> {\n try { return { ok: true, value: await reader.getTree(owner, repo, record.treeSha, signal) } } catch (error) {\n return readFailure(error, 'commit', `${owner}/${repo}`)\n }\n }\n\n return {\n async repositories(signal) {\n if (!reader.listRepositories) return readFailure(new GitHubReadError('unsupported', 'listing unsupported'), 'list')\n try {\n const repositories = await reader.listRepositories(signal)\n return { ok: true, value: { repositories: repositories.map(summary) } }\n } catch (error) { return readFailure(error, 'list') }\n },\n\n async latest(repository, signal) {\n const parts = splitRepository(repository)\n if (!parts) return invalidRepository\n let record: GitHubRepositoryRecord\n try { record = await reader.getRepository(parts[0], parts[1], signal) } catch (error) {\n return readFailure(error, 'repository', repository)\n }\n try {\n const head = await reader.getBranchHead(parts[0], parts[1], record.defaultBranch, signal)\n return { ok: true, value: { repository: summary(record), commit: commitSummary(head, record.defaultBranch) } }\n } catch (error) { return readFailure(error, 'commit', repository) }\n },\n\n async commit(repository, sha, signal) {\n const parts = splitRepository(repository)\n if (!parts) return invalidRepository\n const resolved = await resolveCommit(parts[0], parts[1], sha, signal)\n return resolved.ok ? { ok: true, value: commitSummary(resolved.value) } : resolved\n },\n\n async files(repository, commit, signal): Promise<GitHubSourceOutcome<GitHubFileList>> {\n const parts = splitRepository(repository)\n if (!parts) return invalidRepository\n const resolved = await resolveCommit(parts[0], parts[1], commit, signal)\n if (!resolved.ok) return resolved\n const listing = await tree(parts[0], parts[1], resolved.value, signal)\n if (!listing.ok) return listing\n const blobs = listing.value.entries.filter(entry => entry.type === 'blob')\n return { ok: true, value: {\n commit: commitSummary(resolved.value),\n files: blobs.slice(0, maxFiles).map(entry => ({ path: entry.path, ...(entry.size === undefined ? {} : { size: entry.size }) })),\n truncated: listing.value.truncated || blobs.length > maxFiles,\n } }\n },\n\n async check(request: GitHubSourceRequest, signal): Promise<GitHubSourceOutcome<GitHubSourceCheck>> {\n const parts = splitRepository(request.repository)\n if (!parts) return invalidRepository\n const path = normalizedRepositoryPath(request.path)\n if (!path) return fail('path-not-found', 'Enter a path inside the repository, such as skills/research/SKILL.md.')\n const resolved = await resolveCommit(parts[0], parts[1], request.commit, signal)\n if (!resolved.ok) return resolved\n const listing = await tree(parts[0], parts[1], resolved.value, signal)\n if (!listing.ok) return listing\n const entries = new Map(listing.value.entries.map(entry => [entry.path, entry]))\n let entry = entries.get(path)\n let checkedPath = path\n if (entry?.type === 'tree') {\n const skillFile = request.purpose === 'skill' ? entries.get(`${path}/SKILL.md`) : undefined\n if (!skillFile) {\n return fail('not-a-file', request.purpose === 'skill'\n ? `${path} is a folder without a SKILL.md file. Choose the skill's SKILL.md.`\n : `${path} is a folder. Choose a file inside it.`)\n }\n entry = skillFile\n checkedPath = `${path}/SKILL.md`\n }\n if (!entry || entry.type !== 'blob') {\n return fail('path-not-found', listing.value.truncated\n ? `${path} was not found. This repository is too large to list completely; check the path.`\n : `${path} is not in ${request.repository} at this commit.`)\n }\n if (entry.size !== undefined && entry.size > maxFileBytes) {\n return fail('unsupported-file', `${checkedPath} is ${formatBytes(entry.size)}. Files can be up to ${formatBytes(maxFileBytes)}.`)\n }\n let bytes: Uint8Array\n try { bytes = await reader.getBlob(parts[0], parts[1], entry.sha, signal) } catch (error) {\n return readFailure(error, 'file', request.repository)\n }\n if (bytes.byteLength > maxFileBytes) {\n return fail('unsupported-file', `${checkedPath} is ${formatBytes(bytes.byteLength)}. Files can be up to ${formatBytes(maxFileBytes)}.`)\n }\n const content = utf8(bytes)\n if (content === null) return fail('unsupported-file', `${checkedPath} is not a text file.`)\n const check: GitHubSourceCheck = { repository: request.repository, path: checkedPath,\n commit: commitSummary(resolved.value), size: bytes.byteLength, content }\n if (request.purpose === 'skill') {\n const skill = readSkillFrontmatter(content)\n if (!skill.ok) return fail('not-a-skill', skill.message)\n check.skill = { name: skill.name, description: skill.description }\n }\n return { ok: true, value: check }\n },\n }\n}\n\nexport function formatBytes(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`\n if (bytes < 1024 * 1024) return `${Math.round(bytes / 1024)} KB`\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`\n}\n\n// ── MCP health ──────────────────────────────────────────────────────────────\n\nexport interface McpHealthCheckOptions {\n fetch?: typeof fetch\n /** Total time for the whole check. Defaults to 8 seconds. */\n timeoutMs?: number\n /** The address policy. Return the reason an address is refused, or null. Defaults to {@link publicHttpsUrlProblem}. */\n urlProblem?: (url: string) => string | null\n clientInfo?: { name: string; version: string }\n}\n\nconst MCP_PROTOCOL_VERSION = '2025-06-18'\nconst MAX_MCP_BODY_BYTES = 2 * 1024 * 1024\n\ninterface JsonRpcResponse { id?: unknown; result?: unknown; error?: { code?: number; message?: string } }\n\nclass McpCheckFailure extends Error {\n constructor(readonly problem: Exclude<McpHealth, { ok: true }>['problem'], message: string, readonly status?: number) { super(message) }\n}\n\nfunction publicHeaders(server: AgentProfileMcpServer): Record<string, string> {\n if (!('headers' in server) || !server.headers) return {}\n const headers: Record<string, string> = {}\n for (const [name, value] of Object.entries(server.headers as Record<string, AgentProfileConfigValue>)) {\n if (value && typeof value === 'object' && value.kind === 'public' && typeof value.value === 'string') headers[name] = value.value\n }\n return headers\n}\n\n/** Read Server-Sent Events from a stream, yielding each complete event. */\nasync function* sseEvents(body: ReadableStream<Uint8Array>): AsyncGenerator<{ event: string; data: string }> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let total = 0\n try {\n for (;;) {\n const chunk = await reader.read()\n if (chunk.done) break\n total += chunk.value.byteLength\n if (total > MAX_MCP_BODY_BYTES) throw new McpCheckFailure('protocol-error', 'The server sent more data than a tool listing needs.')\n buffer += decoder.decode(chunk.value, { stream: true }).replace(/\\r\\n/g, '\\n')\n let boundary = buffer.indexOf('\\n\\n')\n while (boundary >= 0) {\n const block = buffer.slice(0, boundary)\n buffer = buffer.slice(boundary + 2)\n let event = 'message'\n const data: string[] = []\n for (const line of block.split('\\n')) {\n if (line.startsWith('event:')) event = line.slice(6).trim()\n else if (line.startsWith('data:')) data.push(line.slice(5).replace(/^ /, ''))\n }\n if (data.length) yield { event, data: data.join('\\n') }\n boundary = buffer.indexOf('\\n\\n')\n }\n }\n } finally {\n await reader.cancel().catch(() => undefined)\n }\n}\n\nasync function readJson(response: Response): Promise<unknown> {\n const text = await response.text()\n if (text.length > MAX_MCP_BODY_BYTES) throw new McpCheckFailure('protocol-error', 'The server sent more data than a tool listing needs.')\n try { return JSON.parse(text) } catch { throw new McpCheckFailure('protocol-error', 'The server did not answer with MCP JSON-RPC.') }\n}\n\nfunction rpcResult(message: unknown, id: number): unknown {\n const items = Array.isArray(message) ? message : [message]\n const match = items.find((item): item is JsonRpcResponse => !!item && typeof item === 'object' && (item as JsonRpcResponse).id === id)\n if (!match) throw new McpCheckFailure('protocol-error', 'The server did not answer the MCP request.')\n if (match.error) throw new McpCheckFailure('protocol-error', `The server returned an MCP error: ${match.error.message ?? match.error.code ?? 'unknown'}.`)\n return match.result\n}\n\nfunction statusFailure(status: number): McpCheckFailure {\n if (status === 401 || status === 403) {\n return new McpCheckFailure('auth-required', 'The server needs credentials. Add them as secret references in Advanced JSON.', status)\n }\n if (status === 404 || status === 405) return new McpCheckFailure('protocol-error', `No MCP endpoint answered at this URL (HTTP ${status}).`, status)\n return new McpCheckFailure('unreachable', `The server answered HTTP ${status}.`, status)\n}\n\nconst toolsSchema = z.object({ tools: z.array(z.object({ name: z.string(), description: z.string().optional() }).passthrough()),\n nextCursor: z.string().optional() })\nconst initializeSchema = z.object({ serverInfo: z.object({ name: z.string().optional(), version: z.string().optional() }).passthrough().optional() }).passthrough()\n\n/**\n * Connect to a remote MCP server, initialize a session, and list its tools.\n * Speaks Streamable HTTP, and the HTTP+SSE transport when the server declares\n * `transport: 'sse'`. Public header values are sent; secret references are not\n * resolved here, so a server that requires them reports `auth-required`.\n */\nexport async function checkMcpServer(server: AgentProfileMcpServer, options: McpHealthCheckOptions = {}): Promise<McpHealth> {\n const checkedAt = new Date().toISOString()\n const started = Date.now()\n const failed = (failure: McpCheckFailure): McpHealth => ({ ok: false, problem: failure.problem, message: failure.message,\n ...(failure.status === undefined ? {} : { status: failure.status }), checkedAt })\n if (server.enabled === false) return failed(new McpCheckFailure('not-checkable', 'Enable the server to check it.'))\n if ('command' in server && server.command) {\n return failed(new McpCheckFailure('not-checkable', 'Local servers start inside the agent workspace, so they are checked when the agent runs.'))\n }\n const url = 'url' in server ? server.url : undefined\n if (!url) return failed(new McpCheckFailure('invalid-url', 'Add the server URL.'))\n const urlProblem = (options.urlProblem ?? publicHttpsUrlProblem)(url)\n if (urlProblem) {\n let parsed = true\n try { new URL(url) } catch { parsed = false }\n return failed(new McpCheckFailure(parsed ? 'blocked-url' : 'invalid-url', urlProblem))\n }\n const send = options.fetch ?? ((input: RequestInfo | URL, init?: RequestInit) => globalThis.fetch(input, init))\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? 8_000)\n const clientInfo = options.clientInfo ?? { name: 'tangle-agent-app', version: '1' }\n const headers = publicHeaders(server)\n const initialize = { jsonrpc: '2.0', id: 1, method: 'initialize',\n params: { protocolVersion: MCP_PROTOCOL_VERSION, capabilities: {}, clientInfo } }\n const initialized = { jsonrpc: '2.0', method: 'notifications/initialized' }\n try {\n const result = 'transport' in server && server.transport === 'sse'\n ? await checkSse(url, headers, send, controller.signal, initialize, initialized)\n : await checkStreamableHttp(url, headers, send, controller.signal, initialize, initialized)\n return { ok: true, ...result, latencyMs: Date.now() - started, checkedAt }\n } catch (error) {\n if (error instanceof McpCheckFailure) return failed(error)\n if (controller.signal.aborted) return failed(new McpCheckFailure('timeout', 'The server did not answer within 8 seconds.'))\n return failed(new McpCheckFailure('unreachable', 'Could not connect to the server. Check the URL and that the server is running.'))\n } finally {\n clearTimeout(timer)\n }\n}\n\ntype Send = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>\ninterface McpListing { tools: McpTool[]; serverName?: string; serverVersion?: string }\n\nfunction listing(info: unknown, pages: unknown[]): McpListing {\n const parsedInfo = initializeSchema.safeParse(info)\n const tools = pages.flatMap(page => {\n const parsed = toolsSchema.safeParse(page)\n if (!parsed.success) throw new McpCheckFailure('protocol-error', 'The server returned a tool list MCP clients cannot read.')\n return parsed.data.tools.map(tool => ({ name: tool.name, ...(tool.description ? { description: tool.description } : {}) }))\n })\n const serverInfo = parsedInfo.success ? parsedInfo.data.serverInfo : undefined\n return { tools, ...(serverInfo?.name ? { serverName: serverInfo.name } : {}), ...(serverInfo?.version ? { serverVersion: serverInfo.version } : {}) }\n}\n\nasync function checkStreamableHttp(url: string, headers: Record<string, string>, send: Send, signal: AbortSignal,\n initialize: object, initialized: object): Promise<McpListing> {\n let session: string | null = null\n let protocol: string | null = null\n async function post(message: object, id?: number): Promise<unknown> {\n const response = await send(url, { method: 'POST', signal, redirect: 'error', body: JSON.stringify(message), headers: {\n ...headers, 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream',\n ...(session ? { 'Mcp-Session-Id': session } : {}), ...(protocol ? { 'MCP-Protocol-Version': protocol } : {}),\n } })\n if (id === undefined) { await response.body?.cancel(); if (!response.ok && response.status !== 202) throw statusFailure(response.status); return undefined }\n if (!response.ok) { await response.body?.cancel(); throw statusFailure(response.status) }\n session = response.headers.get('mcp-session-id') ?? session\n const type = response.headers.get('content-type') ?? ''\n if (type.includes('text/event-stream')) {\n if (!response.body) throw new McpCheckFailure('protocol-error', 'The server opened an empty event stream.')\n for await (const event of sseEvents(response.body)) {\n if (event.event !== 'message') continue\n let parsed: unknown\n try { parsed = JSON.parse(event.data) } catch { continue }\n const items = Array.isArray(parsed) ? parsed : [parsed]\n if (items.some(item => item && typeof item === 'object' && (item as JsonRpcResponse).id === id)) return rpcResult(parsed, id)\n }\n throw new McpCheckFailure('protocol-error', 'The server closed the stream before answering.')\n }\n if (!type.includes('json')) {\n await response.body?.cancel()\n throw new McpCheckFailure('protocol-error', 'The server did not answer with MCP JSON-RPC.')\n }\n return rpcResult(await readJson(response), id)\n }\n const info = await post(initialize, 1)\n const negotiated = initializeSchema.safeParse(info)\n protocol = negotiated.success && typeof (negotiated.data as { protocolVersion?: unknown }).protocolVersion === 'string'\n ? (negotiated.data as { protocolVersion: string }).protocolVersion : MCP_PROTOCOL_VERSION\n await post(initialized)\n const pages: unknown[] = []\n let cursor: string | undefined\n for (let page = 0; page < 5; page++) {\n const result = await post({ jsonrpc: '2.0', id: 2 + page, method: 'tools/list', params: cursor ? { cursor } : {} }, 2 + page)\n pages.push(result)\n const next = toolsSchema.safeParse(result)\n cursor = next.success ? next.data.nextCursor : undefined\n if (!cursor) break\n }\n if (session) {\n await send(url, { method: 'DELETE', signal, headers: { ...headers, 'Mcp-Session-Id': session } })\n .then(response => response.body?.cancel()).catch(() => undefined)\n }\n return listing(info, pages)\n}\n\nasync function checkSse(url: string, headers: Record<string, string>, send: Send, signal: AbortSignal,\n initialize: object, initialized: object): Promise<McpListing> {\n const stream = await send(url, { method: 'GET', signal, redirect: 'error', headers: { ...headers, Accept: 'text/event-stream' } })\n if (!stream.ok) { await stream.body?.cancel(); throw statusFailure(stream.status) }\n if (!stream.body || !(stream.headers.get('content-type') ?? '').includes('text/event-stream')) {\n await stream.body?.cancel()\n throw new McpCheckFailure('protocol-error', 'The server did not open an MCP event stream.')\n }\n const events = sseEvents(stream.body)\n try {\n const first = await events.next()\n if (first.done || first.value.event !== 'endpoint') throw new McpCheckFailure('protocol-error', 'The server did not announce an MCP message endpoint.')\n // The endpoint carries the session in its query, so only its origin is held to the checked address.\n const endpoint = new URL(first.value.data.trim(), url)\n if (endpoint.origin !== new URL(url).origin) {\n throw new McpCheckFailure('protocol-error', 'The server announced a message endpoint on another address.')\n }\n async function post(message: object) {\n const response = await send(endpoint.href, { method: 'POST', signal, redirect: 'error', body: JSON.stringify(message),\n headers: { ...headers, 'Content-Type': 'application/json' } })\n await response.body?.cancel()\n if (!response.ok) throw statusFailure(response.status)\n }\n async function answer(id: number): Promise<unknown> {\n for (;;) {\n const next = await events.next()\n if (next.done) throw new McpCheckFailure('protocol-error', 'The server closed the stream before answering.')\n if (next.value.event !== 'message') continue\n let parsed: unknown\n try { parsed = JSON.parse(next.value.data) } catch { continue }\n if (parsed && typeof parsed === 'object' && (parsed as JsonRpcResponse).id === id) return rpcResult(parsed, id)\n }\n }\n await post(initialize)\n const info = await answer(1)\n await post(initialized)\n await post({ jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} })\n return listing(info, [await answer(2)])\n } finally {\n await events.return(undefined)\n }\n}\n\n/** The editor's MCP port, running checks in this process with the given address policy. */\nexport function createMcpHealthChecker(options: McpHealthCheckOptions = {}): ProfileEditorMcpPort {\n return { check: (server, signal) => {\n if (signal?.aborted) return Promise.resolve({ ok: false, problem: 'unavailable', message: 'The check was cancelled.', checkedAt: new Date().toISOString() })\n return checkMcpServer(server, options)\n } }\n}\n\n// ── Route handler ───────────────────────────────────────────────────────────\n\nexport interface ProfileEditorHandlerOptions {\n /** GitHub lookups for this workspace. Null when the product offers no GitHub sources. */\n github: ProfileEditorGitHubPort | null\n /** MCP checks. Null when the product offers no MCP servers. */\n mcp: ProfileEditorMcpPort | null\n}\n\nconst repositoryParam = z.string().trim().min(3).max(201)\nconst shaParam = z.string().trim().regex(/^[0-9a-f]{40}$/i)\nconst checkBody = z.object({ repository: repositoryParam, path: z.string().min(1).max(400), commit: shaParam,\n purpose: z.enum(['skill', 'file']) }).strict()\nconst mcpBody = z.object({ server: z.object({\n enabled: z.boolean().optional(),\n transport: z.enum(['http', 'sse', 'stdio']).optional(),\n url: z.string().max(2048).optional(),\n command: z.string().max(2048).optional(),\n headers: z.record(z.string(), z.unknown()).optional(),\n}).passthrough() }).strict()\n\nfunction json(body: unknown, status = 200): Response {\n return Response.json(body, { status, headers: { 'Cache-Control': 'no-store' } })\n}\n\nconst MAX_BODY_BYTES = 64 * 1024\n\nasync function readBody(request: Request): Promise<unknown> {\n const text = await request.text()\n if (text.length > MAX_BODY_BYTES) throw new Error('Request body is too large')\n return JSON.parse(text) as unknown\n}\n\n/**\n * Serve the editor's checks. Call it after authenticating the user and\n * authorizing the workspace, with the path below the editor endpoint\n * (for example `github/files`). Unknown paths answer 404.\n */\nexport async function handleProfileEditorRequest(request: Request, path: string, options: ProfileEditorHandlerOptions): Promise<Response> {\n const route = path.replace(/^\\/+|\\/+$/g, '')\n const query = new URL(request.url).searchParams\n const githubRoute = (Object.entries(PROFILE_EDITOR_ROUTES) as [keyof typeof PROFILE_EDITOR_ROUTES, string][])\n .find(([, value]) => value === route)?.[0]\n if (!githubRoute) return json({ error: 'Not found' }, 404)\n const expectsPost = githubRoute === 'check' || githubRoute === 'mcpCheck'\n if (request.method !== (expectsPost ? 'POST' : 'GET')) return json({ error: 'Method not allowed' }, 405)\n const signal = request.signal\n\n if (githubRoute === 'mcpCheck') {\n if (!options.mcp) return json({ ok: false, problem: 'unavailable', message: 'This product does not check MCP servers.', checkedAt: new Date().toISOString() })\n let body: z.infer<typeof mcpBody>\n try { body = mcpBody.parse(await readBody(request)) } catch { return json({ error: 'Send { server } with the MCP server to check.' }, 400) }\n return json(await options.mcp.check(body.server as unknown as AgentProfileMcpServer, signal))\n }\n if (!options.github) return json(fail('unavailable', 'This product does not offer GitHub sources.'))\n const github = options.github\n switch (githubRoute) {\n case 'repositories': return json(await github.repositories(signal))\n case 'latest': {\n const repository = repositoryParam.safeParse(query.get('repository'))\n if (!repository.success) return json({ error: 'repository is required' }, 400)\n return json(await github.latest(repository.data, signal))\n }\n case 'commit':\n case 'files': {\n const repository = repositoryParam.safeParse(query.get('repository'))\n const sha = shaParam.safeParse(query.get(githubRoute === 'commit' ? 'sha' : 'commit'))\n if (!repository.success) return json({ error: 'repository is required' }, 400)\n if (!sha.success) return json(fail('ref-not-found', 'Enter the full 40-character commit SHA.'))\n return json(githubRoute === 'commit' ? await github.commit(repository.data, sha.data, signal) : await github.files(repository.data, sha.data, signal))\n }\n case 'check': {\n let body: z.infer<typeof checkBody>\n try { body = checkBody.parse(await readBody(request)) } catch { return json({ error: 'Send repository, path, a 40-character commit, and purpose.' }, 400) }\n return json(await github.check(body, signal))\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAOA,SAAS,SAAS;AAkBX,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,YAAqB,QAAkD,SAA0B,cAAc,OAAO;AACpH,UAAM,OAAO;AADM;AAA4E;AAE/F,SAAK,OAAO;AAAA,EACd;AAAA,EAHqB;AAAA,EAA4E;AAInG;AA8CA,SAAS,aAAa,MAA0B;AAC9C,QAAM,SAAS,KAAK,KAAK,QAAQ,QAAQ,EAAE,CAAC;AAC5C,QAAM,QAAQ,IAAI,WAAW,OAAO,MAAM;AAC1C,WAAS,QAAQ,GAAG,QAAQ,OAAO,QAAQ,QAAS,OAAM,KAAK,IAAI,OAAO,WAAW,KAAK;AAC1F,SAAO;AACT;AAGO,IAAM,gBAAgB;AAAA,EAC3B,WAAW,OAAwC;AACjD,UAAM,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,GAAG,gBAAgB,EAAE,OAAO,GAAG,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,KAAK;AACjJ,WAAO,EAAE,UAAU,KAAK,WAAW,SAAS,KAAK,SAAS,eAAe,KAAK,gBAAgB,aAAa,KAAK,YAAY;AAAA,EAC9H;AAAA,EACA,aAAa,OAA0C;AACrD,WAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,EAAE,IAAI,UAAQ,cAAc,WAAW,IAAI,CAAC;AAAA,EACrF;AAAA,EACA,OAAO,OAAoC;AACzC,UAAM,OAAO,EAAE,OAAO,EAAE,QA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,MAAM,IAAI,gBAAgB,WAAW,QAAQ,QAAQ,CAAC;AACrF,UAAI,CAAC,WAAW,QAAS,QAAO,KAAK,EAAE,OAAO,yBAAyB,GAAG,GAAG;AAC7E,UAAI,CAAC,IAAI,QAAS,QAAO,KAAK,KAAK,iBAAiB,yCAAyC,CAAC;AAC9F,aAAO,KAAK,gBAAgB,WAAW,MAAM,OAAO,OAAO,WAAW,MAAM,IAAI,MAAM,MAAM,IAAI,MAAM,OAAO,MAAM,WAAW,MAAM,IAAI,MAAM,MAAM,CAAC;AAAA,IACvJ;AAAA,IACA,KAAK,SAAS;AACZ,UAAI;AACJ,UAAI;AAAE,eAAO,UAAU,MAAM,MAAM,SAAS,OAAO,CAAC;AAAA,MAAE,QAAQ;AAAE,eAAO,KAAK,EAAE,OAAO,6DAA6D,GAAG,GAAG;AAAA,MAAE;AAC1J,aAAO,KAAK,MAAM,OAAO,MAAM,MAAM,MAAM,CAAC;AAAA,IAC9C;AAAA,EACF;AACF;","names":["listing","entry"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createChatTurnRoutes,
|
|
3
3
|
streamChatRouteAsSandboxEvents
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-YNSPVKMS.js";
|
|
4
|
+
} from "../chunk-FNRUXPXE.js";
|
|
6
5
|
import "../chunk-6VRVRWYN.js";
|
|
6
|
+
import "../chunk-YNSPVKMS.js";
|
|
7
7
|
import "../chunk-3NCPXNBZ.js";
|
|
8
8
|
import "../chunk-53K4S3K6.js";
|
|
9
9
|
import "../chunk-OEHEHPPA.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-GYDFGEJ2.js";
|
|
10
|
+
import "../chunk-HTAFI247.js";
|
|
12
11
|
import "../chunk-ZVEEWGDK.js";
|
|
12
|
+
import "../chunk-GYDFGEJ2.js";
|
|
13
13
|
import "../chunk-TXD5HXLE.js";
|
|
14
14
|
import "../chunk-N56FWDSP.js";
|
|
15
15
|
import "../chunk-FCON65I2.js";
|
package/dist/sandbox/index.js
CHANGED
|
@@ -103,13 +103,13 @@ import {
|
|
|
103
103
|
} from "../chunk-CJW24QMJ.js";
|
|
104
104
|
import "../chunk-MCYJON3F.js";
|
|
105
105
|
import "../chunk-LWSJK546.js";
|
|
106
|
-
import "../chunk-
|
|
106
|
+
import "../chunk-4ZMZDE24.js";
|
|
107
107
|
import "../chunk-6A7MYOUI.js";
|
|
108
|
+
import "../chunk-4YHE7PGO.js";
|
|
109
|
+
import "../chunk-S5SRJJQG.js";
|
|
108
110
|
import "../chunk-4CBU7QIL.js";
|
|
109
111
|
import "../chunk-UGWQLQDS.js";
|
|
110
|
-
import "../chunk-4YHE7PGO.js";
|
|
111
112
|
import "../chunk-NZNXHCVU.js";
|
|
112
|
-
import "../chunk-S5SRJJQG.js";
|
|
113
113
|
import "../chunk-D6UJEOZQ.js";
|
|
114
114
|
export {
|
|
115
115
|
DEFAULT_FOREGROUND_PROVISION_CLAIM_TTL_SECONDS,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one `SKILL.md` frontmatter parser, in a module with no imports so
|
|
3
|
+
* browser code (the profile editor) can read a skill's name and description
|
|
4
|
+
* without loading the corpus loader's Node fallbacks.
|
|
5
|
+
*/
|
|
6
|
+
/** Fields a `SKILL.md` frontmatter block may declare. All optional — absent
|
|
7
|
+
* frontmatter (or an absent field within it) is legal; callers fill defaults
|
|
8
|
+
* (see {@link skillEntryFromMarkdown}). */
|
|
9
|
+
export interface SkillFrontmatter {
|
|
10
|
+
id?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
author?: {
|
|
14
|
+
name: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
};
|
|
17
|
+
source?: string;
|
|
18
|
+
category?: string;
|
|
19
|
+
tags?: string[];
|
|
20
|
+
tier?: string;
|
|
21
|
+
}
|
|
22
|
+
/** The result of {@link parseSkillFrontmatter}: the parsed fields, the body
|
|
23
|
+
* with the frontmatter block stripped, and the original untouched text. */
|
|
24
|
+
export interface ParsedSkill {
|
|
25
|
+
frontmatter: SkillFrontmatter;
|
|
26
|
+
body: string;
|
|
27
|
+
raw: string;
|
|
28
|
+
}
|
|
29
|
+
/** THE one `SKILL.md` frontmatter parser — hand-rolled, no YAML dependency.
|
|
30
|
+
*
|
|
31
|
+
* Absent frontmatter (text does not open with a `---` delimiter line) is
|
|
32
|
+
* legal: returns `{frontmatter: {}, body: raw, raw}`. An OPENED block with no
|
|
33
|
+
* closing `---` is truncated input and throws. Inside the block: scalar
|
|
34
|
+
* `key: value` lines (value optionally double-quoted, decoded via
|
|
35
|
+
* `JSON.parse`); a nested `author:` block whose indented `name:`/`url:` lines
|
|
36
|
+
* are the only children it accepts; `tags:` as an inline `[a, b]` list or as
|
|
37
|
+
* an indented `- item` block. Unknown scalar keys are ignored (forward-compat)
|
|
38
|
+
* — but a line that matches NONE of these shapes (no colon, an orphaned
|
|
39
|
+
* indented line, a bad dash) throws naming the offending line. Silently
|
|
40
|
+
* mis-parsed metadata is the bug class this parser exists to kill; an
|
|
41
|
+
* unrecognized shape is never guessed at.
|
|
42
|
+
*/
|
|
43
|
+
export declare function parseSkillFrontmatter(raw: string): ParsedSkill;
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -158,44 +158,7 @@ export interface ComposeShellResourcesInput {
|
|
|
158
158
|
* `profile.resources.files` with no cast.
|
|
159
159
|
*/
|
|
160
160
|
export declare function composeShellResources(input: ComposeShellResourcesInput): AgentProfileFileMount[];
|
|
161
|
-
|
|
162
|
-
* frontmatter (or an absent field within it) is legal; callers fill defaults
|
|
163
|
-
* (see {@link skillEntryFromMarkdown}). */
|
|
164
|
-
export interface SkillFrontmatter {
|
|
165
|
-
id?: string;
|
|
166
|
-
name?: string;
|
|
167
|
-
description?: string;
|
|
168
|
-
author?: {
|
|
169
|
-
name: string;
|
|
170
|
-
url?: string;
|
|
171
|
-
};
|
|
172
|
-
source?: string;
|
|
173
|
-
category?: string;
|
|
174
|
-
tags?: string[];
|
|
175
|
-
tier?: string;
|
|
176
|
-
}
|
|
177
|
-
/** The result of {@link parseSkillFrontmatter}: the parsed fields, the body
|
|
178
|
-
* with the frontmatter block stripped, and the original untouched text. */
|
|
179
|
-
export interface ParsedSkill {
|
|
180
|
-
frontmatter: SkillFrontmatter;
|
|
181
|
-
body: string;
|
|
182
|
-
raw: string;
|
|
183
|
-
}
|
|
184
|
-
/** THE one `SKILL.md` frontmatter parser — hand-rolled, no YAML dependency.
|
|
185
|
-
*
|
|
186
|
-
* Absent frontmatter (text does not open with a `---` delimiter line) is
|
|
187
|
-
* legal: returns `{frontmatter: {}, body: raw, raw}`. An OPENED block with no
|
|
188
|
-
* closing `---` is truncated input and throws. Inside the block: scalar
|
|
189
|
-
* `key: value` lines (value optionally double-quoted, decoded via
|
|
190
|
-
* `JSON.parse`); a nested `author:` block whose indented `name:`/`url:` lines
|
|
191
|
-
* are the only children it accepts; `tags:` as an inline `[a, b]` list or as
|
|
192
|
-
* an indented `- item` block. Unknown scalar keys are ignored (forward-compat)
|
|
193
|
-
* — but a line that matches NONE of these shapes (no colon, an orphaned
|
|
194
|
-
* indented line, a bad dash) throws naming the offending line. Silently
|
|
195
|
-
* mis-parsed metadata is the bug class this parser exists to kill; an
|
|
196
|
-
* unrecognized shape is never guessed at.
|
|
197
|
-
*/
|
|
198
|
-
export declare function parseSkillFrontmatter(raw: string): ParsedSkill;
|
|
161
|
+
export { parseSkillFrontmatter, type ParsedSkill, type SkillFrontmatter } from './frontmatter';
|
|
199
162
|
/** Build a {@link SkillEntry} from a raw `SKILL.md` body. `id` comes from
|
|
200
163
|
* frontmatter, falling back to `fallbackId` (typically the corpus entry's
|
|
201
164
|
* slug/filename); neither present throws. `name` defaults to `id`,
|
package/dist/skills/index.js
CHANGED
|
@@ -6,14 +6,16 @@ import {
|
|
|
6
6
|
loadMarkdownCorpus,
|
|
7
7
|
mergeComposedSkills,
|
|
8
8
|
parseCorpusSkills,
|
|
9
|
-
parseSkillFrontmatter,
|
|
10
9
|
registrySkills,
|
|
11
10
|
renderInlineSkills,
|
|
12
11
|
renderSkillIndex,
|
|
13
12
|
skillEntryFromMarkdown,
|
|
14
13
|
skillMountPath,
|
|
15
14
|
skillRefs
|
|
16
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-T5PPQPOD.js";
|
|
16
|
+
import {
|
|
17
|
+
parseSkillFrontmatter
|
|
18
|
+
} from "../chunk-PV33JZKV.js";
|
|
17
19
|
export {
|
|
18
20
|
assertSkillDeliveryDisjoint,
|
|
19
21
|
composeShellResources,
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
composeSkills,
|
|
6
6
|
renderInlineSkills
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-T5PPQPOD.js";
|
|
8
|
+
import "../chunk-PV33JZKV.js";
|
|
8
9
|
|
|
9
10
|
// src/skills-placement/index.ts
|
|
10
11
|
import { skillDirForHarness } from "@tangle-network/agent-profile-materialize";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/skills-placement/index.ts"],"sourcesContent":["/**\n * Harness-native skill directory resolution — the one place agent-app binds\n * to the platform's authoritative per-harness skill-dir map.\n *\n * `../skills` renders skill CONTENT (parse, tier-filter, `inline`/`mounted`\n * delivery) but deliberately stops short of naming WHICH cwd path a `mounted`\n * skill lands at on a given harness — that mapping is owned by the platform\n * materializer (`@tangle-network/agent-profile-materialize`'s\n * `skillDirForHarness`), not by app-shell. This subpath exists so no product\n * — and no other agent-app module — ever writes a skill path literal\n * (`~/.claude/skills/...`, `.opencode/skills`, ...) of its own; it bridges\n * agent-app's `Harness` taxonomy onto the platform's `HarnessId` and asks the\n * platform for the answer.\n *\n * Requires the OPTIONAL peer `@tangle-network/agent-profile-materialize`.\n * Products that don't install it simply don't import this subpath — every\n * other agent-app skills surface (`../skills`, `ProfileChannels.skillRefs`)\n * works without it, falling back to `inline` delivery.\n */\n\nimport { KNOWN_HARNESSES, type Harness } from '../harness/index'\nimport { skillDirForHarness, type HarnessId } from '@tangle-network/agent-profile-materialize'\nimport { composeSkills, renderInlineSkills, type ComposedSkills, type SkillEntry } from '../skills/index'\n\n/** agent-app `Harness` -> platform `HarnessId`, identity-mapped for exactly\n * the harnesses the platform map covers. Harnesses absent here (`amp`,\n * `factory-droids`, `forge`, `acp`, `cursor`, `cli-base`) resolve to `null` —\n * {@link composeSkillsForHarness} refuses by default rather than silently\n * delivering `inline`; a caller that genuinely needs `inline` on one of\n * these opts in explicitly (`onNoSkillDir: 'inline'`). `cursor`'s adapter\n * supports `resources.skills` bespokely but isn't in the platform map yet;\n * treating it as unbridged is the safe posture until the map covers it,\n * rather than guessing its cwd skill dir here. */\nconst HARNESS_BRIDGE: Partial<Record<Harness, HarnessId>> = {\n opencode: 'opencode',\n 'claude-code': 'claude-code',\n nanoclaw: 'nanoclaw',\n 'kimi-code': 'kimi-code',\n codex: 'codex',\n pi: 'pi',\n prime: 'prime',\n hermes: 'hermes',\n openclaw: 'openclaw',\n}\n\n/** Resolve the cwd-relative skill dir `resources.skills` refs materialize\n * into on `harness` — via the platform's `skillDirForHarness`. `null` when\n * `harness` isn't bridged (see {@link HARNESS_BRIDGE}) or when the platform\n * itself has no cwd skill primitive for it (e.g. `hermes`, user-dir-only). */\nexport function resolveSkillDir(harness: Harness): string | null {\n const bridged = HARNESS_BRIDGE[harness]\n if (!bridged) return null\n return skillDirForHarness(bridged)\n}\n\n/** Filter `harnesses` down to those with no mounted skill dir (deduped,\n * first-seen order preserved) — the set that must fall back to `inline`\n * delivery, or that a caller should warn about before offering \"mounted\"\n * install UX. */\nexport function unsupportedSkillHarnesses(harnesses: Iterable<Harness>): Harness[] {\n const seen = new Set<Harness>()\n const out: Harness[] = []\n for (const harness of harnesses) {\n if (resolveSkillDir(harness) !== null) continue\n if (seen.has(harness)) continue\n seen.add(harness)\n out.push(harness)\n }\n return out\n}\n\n/** Inputs to {@link composeSkillsForHarness}. */\nexport interface ComposeSkillsForHarnessInput {\n skills: SkillEntry[]\n harness: Harness\n tier?: string\n heading?: string\n /**\n * What to do when `harness` has no native skill-mount directory (see\n * {@link resolveSkillDir}). Default `'throw'`: refuse rather than silently\n * inlining every skill BODY into the system prompt. Pass `'inline'` only as\n * a deliberate, auditable opt-in — the caller has decided every skill must\n * reach this harness even though it will be concatenated into the prompt.\n */\n onNoSkillDir?: 'throw' | 'inline'\n}\n\n/** `KNOWN_HARNESSES` filtered to those the platform materializer can mount\n * skill files onto natively (a non-null {@link resolveSkillDir}). Computed\n * fresh rather than cached — the platform map can grow without a release\n * here. Used only to build the actionable error in\n * {@link composeSkillsForHarness}; not exported because it duplicates\n * {@link unsupportedSkillHarnesses}'s complement and callers should reach\n * for that instead when they need the harness list at runtime. */\nfunction nativeSkillMountHarnesses(): Harness[] {\n return KNOWN_HARNESSES.filter((harness) => resolveSkillDir(harness) !== null)\n}\n\n/**\n * Compose {@link ComposedSkills} for `harness`.\n *\n * `mounted` delivery is the standard path: whenever the platform names a cwd\n * skill dir for `harness`, skills ride the typed `resources.skills` channel\n * and the platform materializer writes each one to that directory as a real\n * file — the agent reads it on demand with its own file tools.\n *\n * `inline` delivery — every skill BODY rendered straight into the system\n * prompt — is a NARROW fallback for harnesses with no native skill dir, never\n * a co-equal mode. An `AgentProfile` is a RECIPE that materializes into a\n * sandbox, not a prompt template: skill bodies belong in a file mount, and\n * `prompt.systemPrompt` should carry only what the agent must obey without a\n * tool call (identity, tool-call contract, safety rules, output format) plus\n * a short index of what's mounted. Concatenating skill bodies into the prompt\n * degrades the model toward empty answers once it grows large enough — one\n * product reproduced a 151,882-byte prompt exactly this way, from an\n * unnoticed inline fallback.\n *\n * Because of that, `onNoSkillDir` defaults to `'throw'`: a harness with no\n * skill dir refuses instead of silently inlining. The thrown error names the\n * harness, the skill count, the byte size that would have been inlined, and\n * the harnesses that DO support native mounting. Pass `onNoSkillDir:\n * 'inline'` only as a deliberate, auditable opt-in when every skill genuinely\n * must reach this harness regardless of prompt cost.\n *\n * The one function a product calls instead of hand-checking `resolveSkillDir`\n * and branching between {@link composeSkills}'s two modes itself.\n */\nexport function composeSkillsForHarness(input: ComposeSkillsForHarnessInput): ComposedSkills {\n const { skills, harness, tier, heading, onNoSkillDir = 'throw' } = input\n const skillDir = resolveSkillDir(harness)\n if (skillDir) return composeSkills({ skills, mode: 'mounted', skillDir, tier, heading })\n if (onNoSkillDir === 'inline') return composeSkills({ skills, mode: 'inline', tier, heading })\n\n const relevant = tier ? skills.filter((s) => s.tier === tier) : skills\n const promptSection = renderInlineSkills({ skills, tier, heading })\n const bytes = new TextEncoder().encode(promptSection).byteLength\n const mountable = nativeSkillMountHarnesses()\n throw new Error(\n `composeSkillsForHarness: \"${harness}\" has no native skill-mount directory. ` +\n `Inlining ${relevant.length} skill(s) (${bytes} bytes) into its system prompt would silently ` +\n `convert mounted skills into prompt text — a 151,882-byte prompt shipped this way once, and ` +\n `oversized prompts degrade toward empty answers. Mount the skills instead: pick a harness with ` +\n `native skill support (${mountable.join(', ')}), or pass onNoSkillDir: 'inline' to opt in ` +\n `explicitly and accept the inlined bytes.`,\n )\n}\n\nexport type { ComposedSkills, SkillEntry } from '../skills/index'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/skills-placement/index.ts"],"sourcesContent":["/**\n * Harness-native skill directory resolution — the one place agent-app binds\n * to the platform's authoritative per-harness skill-dir map.\n *\n * `../skills` renders skill CONTENT (parse, tier-filter, `inline`/`mounted`\n * delivery) but deliberately stops short of naming WHICH cwd path a `mounted`\n * skill lands at on a given harness — that mapping is owned by the platform\n * materializer (`@tangle-network/agent-profile-materialize`'s\n * `skillDirForHarness`), not by app-shell. This subpath exists so no product\n * — and no other agent-app module — ever writes a skill path literal\n * (`~/.claude/skills/...`, `.opencode/skills`, ...) of its own; it bridges\n * agent-app's `Harness` taxonomy onto the platform's `HarnessId` and asks the\n * platform for the answer.\n *\n * Requires the OPTIONAL peer `@tangle-network/agent-profile-materialize`.\n * Products that don't install it simply don't import this subpath — every\n * other agent-app skills surface (`../skills`, `ProfileChannels.skillRefs`)\n * works without it, falling back to `inline` delivery.\n */\n\nimport { KNOWN_HARNESSES, type Harness } from '../harness/index'\nimport { skillDirForHarness, type HarnessId } from '@tangle-network/agent-profile-materialize'\nimport { composeSkills, renderInlineSkills, type ComposedSkills, type SkillEntry } from '../skills/index'\n\n/** agent-app `Harness` -> platform `HarnessId`, identity-mapped for exactly\n * the harnesses the platform map covers. Harnesses absent here (`amp`,\n * `factory-droids`, `forge`, `acp`, `cursor`, `cli-base`) resolve to `null` —\n * {@link composeSkillsForHarness} refuses by default rather than silently\n * delivering `inline`; a caller that genuinely needs `inline` on one of\n * these opts in explicitly (`onNoSkillDir: 'inline'`). `cursor`'s adapter\n * supports `resources.skills` bespokely but isn't in the platform map yet;\n * treating it as unbridged is the safe posture until the map covers it,\n * rather than guessing its cwd skill dir here. */\nconst HARNESS_BRIDGE: Partial<Record<Harness, HarnessId>> = {\n opencode: 'opencode',\n 'claude-code': 'claude-code',\n nanoclaw: 'nanoclaw',\n 'kimi-code': 'kimi-code',\n codex: 'codex',\n pi: 'pi',\n prime: 'prime',\n hermes: 'hermes',\n openclaw: 'openclaw',\n}\n\n/** Resolve the cwd-relative skill dir `resources.skills` refs materialize\n * into on `harness` — via the platform's `skillDirForHarness`. `null` when\n * `harness` isn't bridged (see {@link HARNESS_BRIDGE}) or when the platform\n * itself has no cwd skill primitive for it (e.g. `hermes`, user-dir-only). */\nexport function resolveSkillDir(harness: Harness): string | null {\n const bridged = HARNESS_BRIDGE[harness]\n if (!bridged) return null\n return skillDirForHarness(bridged)\n}\n\n/** Filter `harnesses` down to those with no mounted skill dir (deduped,\n * first-seen order preserved) — the set that must fall back to `inline`\n * delivery, or that a caller should warn about before offering \"mounted\"\n * install UX. */\nexport function unsupportedSkillHarnesses(harnesses: Iterable<Harness>): Harness[] {\n const seen = new Set<Harness>()\n const out: Harness[] = []\n for (const harness of harnesses) {\n if (resolveSkillDir(harness) !== null) continue\n if (seen.has(harness)) continue\n seen.add(harness)\n out.push(harness)\n }\n return out\n}\n\n/** Inputs to {@link composeSkillsForHarness}. */\nexport interface ComposeSkillsForHarnessInput {\n skills: SkillEntry[]\n harness: Harness\n tier?: string\n heading?: string\n /**\n * What to do when `harness` has no native skill-mount directory (see\n * {@link resolveSkillDir}). Default `'throw'`: refuse rather than silently\n * inlining every skill BODY into the system prompt. Pass `'inline'` only as\n * a deliberate, auditable opt-in — the caller has decided every skill must\n * reach this harness even though it will be concatenated into the prompt.\n */\n onNoSkillDir?: 'throw' | 'inline'\n}\n\n/** `KNOWN_HARNESSES` filtered to those the platform materializer can mount\n * skill files onto natively (a non-null {@link resolveSkillDir}). Computed\n * fresh rather than cached — the platform map can grow without a release\n * here. Used only to build the actionable error in\n * {@link composeSkillsForHarness}; not exported because it duplicates\n * {@link unsupportedSkillHarnesses}'s complement and callers should reach\n * for that instead when they need the harness list at runtime. */\nfunction nativeSkillMountHarnesses(): Harness[] {\n return KNOWN_HARNESSES.filter((harness) => resolveSkillDir(harness) !== null)\n}\n\n/**\n * Compose {@link ComposedSkills} for `harness`.\n *\n * `mounted` delivery is the standard path: whenever the platform names a cwd\n * skill dir for `harness`, skills ride the typed `resources.skills` channel\n * and the platform materializer writes each one to that directory as a real\n * file — the agent reads it on demand with its own file tools.\n *\n * `inline` delivery — every skill BODY rendered straight into the system\n * prompt — is a NARROW fallback for harnesses with no native skill dir, never\n * a co-equal mode. An `AgentProfile` is a RECIPE that materializes into a\n * sandbox, not a prompt template: skill bodies belong in a file mount, and\n * `prompt.systemPrompt` should carry only what the agent must obey without a\n * tool call (identity, tool-call contract, safety rules, output format) plus\n * a short index of what's mounted. Concatenating skill bodies into the prompt\n * degrades the model toward empty answers once it grows large enough — one\n * product reproduced a 151,882-byte prompt exactly this way, from an\n * unnoticed inline fallback.\n *\n * Because of that, `onNoSkillDir` defaults to `'throw'`: a harness with no\n * skill dir refuses instead of silently inlining. The thrown error names the\n * harness, the skill count, the byte size that would have been inlined, and\n * the harnesses that DO support native mounting. Pass `onNoSkillDir:\n * 'inline'` only as a deliberate, auditable opt-in when every skill genuinely\n * must reach this harness regardless of prompt cost.\n *\n * The one function a product calls instead of hand-checking `resolveSkillDir`\n * and branching between {@link composeSkills}'s two modes itself.\n */\nexport function composeSkillsForHarness(input: ComposeSkillsForHarnessInput): ComposedSkills {\n const { skills, harness, tier, heading, onNoSkillDir = 'throw' } = input\n const skillDir = resolveSkillDir(harness)\n if (skillDir) return composeSkills({ skills, mode: 'mounted', skillDir, tier, heading })\n if (onNoSkillDir === 'inline') return composeSkills({ skills, mode: 'inline', tier, heading })\n\n const relevant = tier ? skills.filter((s) => s.tier === tier) : skills\n const promptSection = renderInlineSkills({ skills, tier, heading })\n const bytes = new TextEncoder().encode(promptSection).byteLength\n const mountable = nativeSkillMountHarnesses()\n throw new Error(\n `composeSkillsForHarness: \"${harness}\" has no native skill-mount directory. ` +\n `Inlining ${relevant.length} skill(s) (${bytes} bytes) into its system prompt would silently ` +\n `convert mounted skills into prompt text — a 151,882-byte prompt shipped this way once, and ` +\n `oversized prompts degrade toward empty answers. Mount the skills instead: pick a harness with ` +\n `native skill support (${mountable.join(', ')}), or pass onNoSkillDir: 'inline' to opt in ` +\n `explicitly and accept the inlined bytes.`,\n )\n}\n\nexport type { ComposedSkills, SkillEntry } from '../skills/index'\n"],"mappings":";;;;;;;;;;AAqBA,SAAS,0BAA0C;AAYnD,IAAM,iBAAsD;AAAA,EAC1D,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,aAAa;AAAA,EACb,OAAO;AAAA,EACP,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AACZ;AAMO,SAAS,gBAAgB,SAAiC;AAC/D,QAAM,UAAU,eAAe,OAAO;AACtC,MAAI,CAAC,QAAS,QAAO;AACrB,SAAO,mBAAmB,OAAO;AACnC;AAMO,SAAS,0BAA0B,WAAyC;AACjF,QAAM,OAAO,oBAAI,IAAa;AAC9B,QAAM,MAAiB,CAAC;AACxB,aAAW,WAAW,WAAW;AAC/B,QAAI,gBAAgB,OAAO,MAAM,KAAM;AACvC,QAAI,KAAK,IAAI,OAAO,EAAG;AACvB,SAAK,IAAI,OAAO;AAChB,QAAI,KAAK,OAAO;AAAA,EAClB;AACA,SAAO;AACT;AAyBA,SAAS,4BAAuC;AAC9C,SAAO,gBAAgB,OAAO,CAAC,YAAY,gBAAgB,OAAO,MAAM,IAAI;AAC9E;AA+BO,SAAS,wBAAwB,OAAqD;AAC3F,QAAM,EAAE,QAAQ,SAAS,MAAM,SAAS,eAAe,QAAQ,IAAI;AACnE,QAAM,WAAW,gBAAgB,OAAO;AACxC,MAAI,SAAU,QAAO,cAAc,EAAE,QAAQ,MAAM,WAAW,UAAU,MAAM,QAAQ,CAAC;AACvF,MAAI,iBAAiB,SAAU,QAAO,cAAc,EAAE,QAAQ,MAAM,UAAU,MAAM,QAAQ,CAAC;AAE7F,QAAM,WAAW,OAAO,OAAO,OAAO,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI;AAChE,QAAM,gBAAgB,mBAAmB,EAAE,QAAQ,MAAM,QAAQ,CAAC;AAClE,QAAM,QAAQ,IAAI,YAAY,EAAE,OAAO,aAAa,EAAE;AACtD,QAAM,YAAY,0BAA0B;AAC5C,QAAM,IAAI;AAAA,IACR,6BAA6B,OAAO,mDACtB,SAAS,MAAM,cAAc,KAAK,qQAGrB,UAAU,KAAK,IAAI,CAAC;AAAA,EAEjD;AACF;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic ports for the profile editor stories and browser checks. They
|
|
3
|
+
* answer like a product route would, including each GitHub and MCP failure
|
|
4
|
+
* the editor must explain. No network access.
|
|
5
|
+
*/
|
|
6
|
+
import type { AgentProfile } from '@tangle-network/agent-interface/profile';
|
|
7
|
+
import type { ProfileEditorGitHubPort, ProfileEditorMcpPort } from '../../profile-editor';
|
|
8
|
+
import type { CatalogModel } from '../../web-react';
|
|
9
|
+
export declare const profileEditorModels: CatalogModel[];
|
|
10
|
+
/** GitHub answers for three repositories, plus `acme/locked` (no access) and anything else (not found). */
|
|
11
|
+
export declare function profileEditorGitHubPort({ connected }?: {
|
|
12
|
+
connected?: boolean;
|
|
13
|
+
}): ProfileEditorGitHubPort;
|
|
14
|
+
/** MCP checks: `auth.` hosts need credentials, `down.` hosts are unreachable, `slow.` hosts time out; others list tools. */
|
|
15
|
+
export declare function profileEditorMcpPort(): ProfileEditorMcpPort;
|
|
16
|
+
/** A configured go-to-market profile: inline skills, several MCP states, and reference files. */
|
|
17
|
+
export declare const productProfile: AgentProfile;
|
|
@@ -39,8 +39,8 @@ import {
|
|
|
39
39
|
} from "../chunk-PT7H37YH.js";
|
|
40
40
|
import {
|
|
41
41
|
useInfiniteScroll
|
|
42
|
-
} from "../chunk-
|
|
43
|
-
import "../chunk-
|
|
42
|
+
} from "../chunk-BDCATWBV.js";
|
|
43
|
+
import "../chunk-Q3BLSWYP.js";
|
|
44
44
|
import {
|
|
45
45
|
CheckGlyph,
|
|
46
46
|
ChevronDown,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
POPOVER_SURFACE_ATTR,
|
|
50
50
|
PopoverSurface,
|
|
51
51
|
usePopover
|
|
52
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-OFQUM5FP.js";
|
|
53
53
|
import "../chunk-SJWIZT7B.js";
|
|
54
54
|
import {
|
|
55
55
|
ProviderLogo
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SeatLimitError
|
|
3
|
+
} from "../chunk-MEUNTJL5.js";
|
|
1
4
|
import {
|
|
2
5
|
generateInvitationToken,
|
|
3
6
|
getInvitationExpiresAt,
|
|
@@ -5,9 +8,6 @@ import {
|
|
|
5
8
|
normalizeInvitationEmail,
|
|
6
9
|
parseInvitationPermission
|
|
7
10
|
} from "../chunk-2DRYTJHI.js";
|
|
8
|
-
import {
|
|
9
|
-
SeatLimitError
|
|
10
|
-
} from "../chunk-MEUNTJL5.js";
|
|
11
11
|
import "../chunk-DJ4VJIH5.js";
|
|
12
12
|
import {
|
|
13
13
|
hasWorkspaceRole
|
package/dist/tools/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
restrictTaxonomy,
|
|
10
10
|
verifyCapabilityToken,
|
|
11
11
|
verifyExpiringCapabilityToken
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-4ZMZDE24.js";
|
|
13
13
|
import {
|
|
14
14
|
DEFAULT_APP_TOOL_PATHS,
|
|
15
15
|
DEFAULT_HEADER_NAMES,
|
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
readToolArgs,
|
|
23
23
|
unresolvableSurfaceCredential
|
|
24
24
|
} from "../chunk-6A7MYOUI.js";
|
|
25
|
+
import "../chunk-4YHE7PGO.js";
|
|
26
|
+
import "../chunk-S5SRJJQG.js";
|
|
25
27
|
import {
|
|
26
28
|
APP_TOOL_NAMES,
|
|
27
29
|
buildAppToolOpenAITools,
|
|
@@ -31,11 +33,9 @@ import {
|
|
|
31
33
|
isAppToolName
|
|
32
34
|
} from "../chunk-4CBU7QIL.js";
|
|
33
35
|
import "../chunk-UGWQLQDS.js";
|
|
34
|
-
import "../chunk-4YHE7PGO.js";
|
|
35
36
|
import {
|
|
36
37
|
ToolInputError
|
|
37
38
|
} from "../chunk-NZNXHCVU.js";
|
|
38
|
-
import "../chunk-S5SRJJQG.js";
|
|
39
39
|
export {
|
|
40
40
|
APP_TOOL_NAMES,
|
|
41
41
|
DEFAULT_APP_TOOL_PATHS,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The shared 3-pane vault: tree | artifact viewer | optional agent dock. This is
|
|
3
|
-
*
|
|
3
|
+
* shell mechanism — selection, the dirty-guard + pending-nav state machine,
|
|
4
4
|
* rich/source editor modes, create/delete/refresh, skeletons, and an error
|
|
5
|
-
* boundary
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* boundary — plus the vault's own tree (`VaultTree`) in a contained surface. It
|
|
6
|
+
* renders no artifact viewer of its own: that arrives through the
|
|
7
|
+
* `renderArtifact` / `renderDock` seams, and `renderTree` can replace the tree.
|
|
8
8
|
*
|
|
9
9
|
* Data flows exclusively through `port` (a `VaultDataPort`). The pane never
|
|
10
10
|
* imports a fetch client, a router, a toast system, or a markdown library — the
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The vault's file tree: folders start collapsed, the reader's expansion is
|
|
3
|
+
* remembered per `storageKey` in this browser, and opening or linking to a file
|
|
4
|
+
* reveals only that file's path.
|
|
5
|
+
*
|
|
6
|
+
* Rendering is lazy: only the children of expanded folders are walked or
|
|
7
|
+
* mounted, and a folder with more than `CHILD_PAGE` children renders them a page
|
|
8
|
+
* at a time, so a vault with thousands of files costs only what is on screen.
|
|
9
|
+
*
|
|
10
|
+
* The tree follows the WAI-ARIA tree pattern with a single tab stop: arrow keys
|
|
11
|
+
* move between rows, Right/Left expand, collapse or move to a child or parent,
|
|
12
|
+
* Home/End jump, and Enter or Space open a file or toggle a folder.
|
|
13
|
+
*/
|
|
14
|
+
import type { VaultTreeNode } from './contracts';
|
|
15
|
+
/** Children rendered per folder before a "Show more" row. */
|
|
16
|
+
export declare const VAULT_TREE_CHILD_PAGE = 200;
|
|
17
|
+
export interface VaultTreeProps {
|
|
18
|
+
/** The listed collection; its children are the top-level rows. */
|
|
19
|
+
root: VaultTreeNode;
|
|
20
|
+
/** The open file. Its row is marked selected and its folders are revealed when it changes. */
|
|
21
|
+
selectedPath?: string;
|
|
22
|
+
/** A folder the host treats as current, such as a create target. */
|
|
23
|
+
activeFolder?: string | null;
|
|
24
|
+
/** Called with a file's path when the reader opens it. */
|
|
25
|
+
onSelect: (path: string) => void;
|
|
26
|
+
/** Called after the reader expands or collapses a folder. */
|
|
27
|
+
onFolderToggle?: (path: string, expanded: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Remembers folder expansion in this browser under this key, for example
|
|
30
|
+
* `${userId}:${workspaceId}`. Omit to keep expansion for the mounted tree only.
|
|
31
|
+
*/
|
|
32
|
+
storageKey?: string;
|
|
33
|
+
/** Show every folder open without changing the remembered expansion, as while filtering. */
|
|
34
|
+
expandAll?: boolean;
|
|
35
|
+
/** Accessible name of the tree. */
|
|
36
|
+
label?: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function VaultTree({ root, selectedPath, activeFolder, onSelect, onFolderToggle, storageKey, expandAll, label, className, }: VaultTreeProps): import("react").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Seams between the shared VaultPane and the host product. Everything here is
|
|
3
|
-
* interface-only: the pane never imports
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* interface-only: the pane never imports an artifact viewer, a dialog library,
|
|
4
|
+
* or a product's data client. The product supplies the data (`VaultDataPort`)
|
|
5
|
+
* and the renderers (`renderArtifact`/`renderDock`, optionally `renderTree`),
|
|
6
6
|
* so the same 3-pane vault mounts in any Tangle agent product.
|
|
7
7
|
*
|
|
8
8
|
* `VaultTreeNode` BYTE-MATCHES sandbox-ui's `FileNode` so a product's tree
|
|
@@ -42,7 +42,7 @@ export interface VaultFile {
|
|
|
42
42
|
* pane calls these; it never knows the transport.
|
|
43
43
|
*/
|
|
44
44
|
export interface VaultDataPort {
|
|
45
|
-
/** List the full vault tree. The returned nodes feed
|
|
45
|
+
/** List the full vault tree. The returned nodes feed the tree directly. */
|
|
46
46
|
listTree(): Promise<VaultTreeNode[]>;
|
|
47
47
|
/** Read a single file by path. */
|
|
48
48
|
readFile(path: string): Promise<VaultFile>;
|
|
@@ -102,7 +102,7 @@ export interface VaultPaneHandle {
|
|
|
102
102
|
*/
|
|
103
103
|
openFile: (path: string) => Promise<boolean>;
|
|
104
104
|
}
|
|
105
|
-
/** Props the pane passes to
|
|
105
|
+
/** Props the pane passes to a product's replacement tree renderer. */
|
|
106
106
|
export interface VaultTreeRenderProps {
|
|
107
107
|
root: VaultTreeNode;
|
|
108
108
|
selectedPath?: string;
|
|
@@ -153,8 +153,18 @@ export type VaultEditorMode = 'rich' | 'source';
|
|
|
153
153
|
export interface VaultPaneProps {
|
|
154
154
|
/** Product-owned data access. */
|
|
155
155
|
port: VaultDataPort;
|
|
156
|
-
/**
|
|
157
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Replaces the built-in tree. Omit it to use `VaultTree`: folders start
|
|
158
|
+
* collapsed, expansion is remembered under `treeStateKey`, and the open file's
|
|
159
|
+
* path is revealed.
|
|
160
|
+
*/
|
|
161
|
+
renderTree?: (props: VaultTreeRenderProps) => ReactNode;
|
|
162
|
+
/**
|
|
163
|
+
* Remembers which folders the reader expanded, in this browser, under this
|
|
164
|
+
* key. Pass the scope the tree belongs to, such as `${userId}:${workspaceId}`.
|
|
165
|
+
* Omit it and folders reopen collapsed on every visit.
|
|
166
|
+
*/
|
|
167
|
+
treeStateKey?: string;
|
|
158
168
|
/** Renders the center artifact pane. The product passes sandbox-ui's FileArtifactPane. */
|
|
159
169
|
renderArtifact: (props: VaultArtifactRenderProps) => ReactNode;
|
|
160
170
|
/** Renders an optional right dock (agent chat, metadata, …). Omit to hide. */
|
package/dist/vault/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@tangle-network/agent-app/vault` — the shared 3-pane VaultPane (tree |
|
|
3
3
|
* artifact viewer | optional agent dock) every Tangle agent product otherwise
|
|
4
|
-
* hand-rolls
|
|
5
|
-
*
|
|
6
|
-
* The product supplies the data (`VaultDataPort`) and the
|
|
7
|
-
*
|
|
4
|
+
* hand-rolls: selection, the dirty-guard state machine, rich/source editor
|
|
5
|
+
* modes, create/delete, skeletons, an error boundary, and the vault's file tree
|
|
6
|
+
* (`VaultTree`). The product supplies the data (`VaultDataPort`) and the artifact
|
|
7
|
+
* renderer; the pane imports no artifact viewer and no dialog library.
|
|
8
8
|
*
|
|
9
9
|
* Never re-exported from the package root barrel — `react` is an optional peer
|
|
10
10
|
* and DOM access begins only inside component render. A `React.lazy` code-split
|
|
@@ -12,4 +12,5 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export * from './contracts';
|
|
14
14
|
export { VaultPane } from './VaultPane';
|
|
15
|
+
export { VaultTree, VAULT_TREE_CHILD_PAGE, type VaultTreeProps } from './VaultTree';
|
|
15
16
|
export { ConfirmDialog, type ConfirmDialogProps } from './ConfirmDialog';
|
package/dist/vault/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfirmDialog,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
VAULT_TREE_CHILD_PAGE,
|
|
4
|
+
VaultPane,
|
|
5
|
+
VaultTree
|
|
6
|
+
} from "../chunk-UGPV7VEW.js";
|
|
5
7
|
export {
|
|
6
8
|
ConfirmDialog,
|
|
7
|
-
|
|
9
|
+
VAULT_TREE_CHILD_PAGE,
|
|
10
|
+
VaultPane,
|
|
11
|
+
VaultTree
|
|
8
12
|
};
|
|
9
13
|
//# sourceMappingURL=index.js.map
|
package/dist/vault/lazy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/vault/lazy.tsx
|
|
2
2
|
import { lazy } from "react";
|
|
3
3
|
var VaultPaneLazy = lazy(
|
|
4
|
-
() => import("../VaultPane-
|
|
4
|
+
() => import("../VaultPane-RIJM452Y.js").then((m) => ({ default: m.VaultPane }))
|
|
5
5
|
);
|
|
6
6
|
export {
|
|
7
7
|
VaultPaneLazy
|