zidane 6.2.6 → 6.2.10

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.
Files changed (103) hide show
  1. package/dist/{acp-CYJvnqPa.js → acp-DuEMbOoQ.js} +4 -4
  2. package/dist/{acp-CYJvnqPa.js.map → acp-DuEMbOoQ.js.map} +1 -1
  3. package/dist/acp-cli.js +6 -6
  4. package/dist/acp.d.ts +1 -1
  5. package/dist/acp.js +1 -1
  6. package/dist/{agent-D11SxCvA.js → agent-6iGNP46b.js} +5 -5
  7. package/dist/{agent-D11SxCvA.js.map → agent-6iGNP46b.js.map} +1 -1
  8. package/dist/agent.d.ts +1 -1
  9. package/dist/agent.js +1 -1
  10. package/dist/{anthropic-DdlSgT6K.js → anthropic-BD-lwEKp.js} +3 -3
  11. package/dist/{anthropic-DdlSgT6K.js.map → anthropic-BD-lwEKp.js.map} +1 -1
  12. package/dist/{auth-Ys_7TmRj.js → auth-BH6G59RL.js} +8 -6
  13. package/dist/auth-BH6G59RL.js.map +1 -0
  14. package/dist/chat/pure.d.ts +3 -3
  15. package/dist/chat.d.ts +14 -44
  16. package/dist/chat.d.ts.map +1 -1
  17. package/dist/chat.js +3 -3
  18. package/dist/contexts/daytona.d.ts +1 -1
  19. package/dist/contexts/e2b.d.ts +1 -1
  20. package/dist/eval.d.ts +1 -1
  21. package/dist/eval.js +1 -1
  22. package/dist/extensions.d.ts +1 -1
  23. package/dist/extensions.js +1 -1
  24. package/dist/headless.d.ts +1 -1
  25. package/dist/headless.js +3 -3
  26. package/dist/{index-CNyYEOy0.d.ts → index-BFNt9GAs.d.ts} +59 -7
  27. package/dist/index-BFNt9GAs.d.ts.map +1 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +9 -9
  30. package/dist/{login-Bp_tRj_e.js → login-B5nMPF8w.js} +3 -3
  31. package/dist/{login-Bp_tRj_e.js.map → login-B5nMPF8w.js.map} +1 -1
  32. package/dist/{mcp-CkHUripi.js → mcp-BCaN_Gyg.js} +140 -29
  33. package/dist/mcp-BCaN_Gyg.js.map +1 -0
  34. package/dist/mcp.d.ts +1 -1
  35. package/dist/mcp.js +1 -1
  36. package/dist/{messages-Ce4yRjd3.js → messages-BDpXLFoe.js} +2 -2
  37. package/dist/{messages-Ce4yRjd3.js.map → messages-BDpXLFoe.js.map} +1 -1
  38. package/dist/{openai-compat-TA7aihJ-.js → openai-compat-J_JZ7qsw.js} +7 -1
  39. package/dist/openai-compat-J_JZ7qsw.js.map +1 -0
  40. package/dist/output/stream-json.d.ts +1 -1
  41. package/dist/output/terminal.d.ts +1 -1
  42. package/dist/presets.d.ts +1 -1
  43. package/dist/presets.js +1 -1
  44. package/dist/providers/anthropic.d.ts +1 -1
  45. package/dist/providers/anthropic.js +1 -1
  46. package/dist/providers/arcee.d.ts +1 -1
  47. package/dist/providers/arcee.js +1 -1
  48. package/dist/providers/baseten.d.ts +1 -1
  49. package/dist/providers/baseten.js +1 -1
  50. package/dist/providers/cerebras.d.ts +1 -1
  51. package/dist/providers/cerebras.js +1 -1
  52. package/dist/providers/local.d.ts +1 -1
  53. package/dist/providers/local.js +1 -1
  54. package/dist/providers/openai-compat.d.ts +1 -1
  55. package/dist/providers/openai-compat.js +1 -1
  56. package/dist/providers/openai.d.ts +1 -1
  57. package/dist/providers/openai.js +79 -34
  58. package/dist/providers/openai.js.map +1 -1
  59. package/dist/providers/openrouter.d.ts +1 -1
  60. package/dist/providers/openrouter.js +1 -1
  61. package/dist/providers/xai.d.ts +1 -1
  62. package/dist/providers/xai.js +1 -1
  63. package/dist/{providers-Dln69sQ_.js → providers-CclOzGxc.js} +3 -3
  64. package/dist/{providers-Dln69sQ_.js.map → providers-CclOzGxc.js.map} +1 -1
  65. package/dist/providers.d.ts +1 -1
  66. package/dist/providers.js +4 -4
  67. package/dist/restate.d.ts +1 -1
  68. package/dist/session/sqlite.d.ts +1 -1
  69. package/dist/{session-D7JSEMME.js → session-CIXE-Bzp.js} +2 -2
  70. package/dist/{session-D7JSEMME.js.map → session-CIXE-Bzp.js.map} +1 -1
  71. package/dist/session.d.ts +1 -1
  72. package/dist/session.js +2 -2
  73. package/dist/{skills-BlmY7QhV.js → skills-CDpejYOf.js} +168 -44
  74. package/dist/skills-CDpejYOf.js.map +1 -0
  75. package/dist/skills.d.ts +2 -2
  76. package/dist/skills.js +1 -1
  77. package/dist/{tool-formatters-B7oWiy5m.d.ts → tool-formatters-B_zQsYfa.d.ts} +2 -2
  78. package/dist/{tool-formatters-B7oWiy5m.d.ts.map → tool-formatters-B_zQsYfa.d.ts.map} +1 -1
  79. package/dist/tools/fetch-url.d.ts +1 -1
  80. package/dist/tools/web-search.d.ts +1 -1
  81. package/dist/tools.d.ts +1 -1
  82. package/dist/tools.js +1 -1
  83. package/dist/{transcript-anchors-cc4gsU-j.js → transcript-anchors-BUigMBQt.js} +227 -11
  84. package/dist/transcript-anchors-BUigMBQt.js.map +1 -0
  85. package/dist/{transcript-anchors-BUZ915pM.d.ts → transcript-anchors-C1Zqb8uS.d.ts} +49 -3
  86. package/dist/transcript-anchors-C1Zqb8uS.d.ts.map +1 -0
  87. package/dist/tui.d.ts +12 -7
  88. package/dist/tui.d.ts.map +1 -1
  89. package/dist/tui.js +391 -70
  90. package/dist/tui.js.map +1 -1
  91. package/dist/{turn-operations-2Ou_DkbC.d.ts → turn-operations-DVA52KMG.d.ts} +3 -3
  92. package/dist/{turn-operations-2Ou_DkbC.d.ts.map → turn-operations-DVA52KMG.d.ts.map} +1 -1
  93. package/dist/types.d.ts +1 -1
  94. package/dist/{xai-kGdhWmds.js → xai-D-wALLuZ.js} +2 -2
  95. package/dist/{xai-kGdhWmds.js.map → xai-D-wALLuZ.js.map} +1 -1
  96. package/package.json +2 -2
  97. package/dist/auth-Ys_7TmRj.js.map +0 -1
  98. package/dist/index-CNyYEOy0.d.ts.map +0 -1
  99. package/dist/mcp-CkHUripi.js.map +0 -1
  100. package/dist/openai-compat-TA7aihJ-.js.map +0 -1
  101. package/dist/skills-BlmY7QhV.js.map +0 -1
  102. package/dist/transcript-anchors-BUZ915pM.d.ts.map +0 -1
  103. package/dist/transcript-anchors-cc4gsU-j.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-CDpejYOf.js","names":[],"sources":["../src/skills/install.ts","../src/skills/index.ts"],"sourcesContent":["/**\n * Skill installation — fetch a skill (or a collection of skills) from\n * GitHub / npm / skills.sh and land it under the zidane skills root,\n * where the existing discovery scan picks it up.\n *\n * Built on the shared install layer (`src/install/source.ts`), so the\n * spec grammar, transports, download caps, and subdir containment are\n * byte-identical with the extensions installer. What differs:\n *\n * - **Validation never executes code.** A skill is data: candidates\n * are validated by parsing `SKILL.md` (lenient parser, same one\n * discovery uses) — unlike extensions, whose validation must import\n * the module. Installing a hostile skill can plant instructions,\n * never run a process.\n * - **skills.sh interop, two-way.** The spec grammar accepts pasted\n * `https://skills.sh/<owner>/<repo>[/<skill>]` catalog URLs (mapped\n * to the GitHub repo + a skill selector — skills.sh uses GitHub as\n * its registry). And when the `skills` CLI is on PATH,\n * {@link installSkillFromSpec} delegates to it (`skills add … -y`)\n * so installs land in the user's cross-agent `.agents/skills/`\n * layout and feed the skills.sh lockfile/leaderboard; without the\n * CLI the native fetch path installs the same repos directly.\n * - **Target roots**: `~/.zidane/skills/<name>` (user) or\n * `<gitRoot>/.zidane/skills/<name>` (project) — both already on\n * discovery's default scan paths.\n *\n * Same hardening as extensions: staged `mkdtemp` fetch, physical\n * symlink containment for `:subdir`, folder-safe names, overwrite with\n * backup/rollback, and a provenance file (`.zidane-install.json`) so a\n * future update flow can replay the spec.\n */\n\nimport type { InstallIo, InstallScope, InstallSource } from '../install/source'\nimport { cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { basename, join, resolve } from 'node:path'\nimport { projectUserPaths } from '../chat/project-user-paths'\nimport { errorMessage } from '../errors'\nimport { defaultExec, defaultWhich, fetchInstallSource, InstallSourceError, lastLine, parseInstallSource, resolveSubdirRoot } from '../install/source'\nimport { parseSkillFile } from './discovery'\nimport { validateSkillName } from './validate'\n\n// ---------------------------------------------------------------------------\n// Errors\n// ---------------------------------------------------------------------------\n\nexport type SkillInstallErrorCode\n = | 'invalid-source'\n | 'fetch-failed'\n | 'no-skill'\n | 'multiple-candidates'\n | 'validate-failed'\n | 'exists'\n | 'cli-failed'\n | 'io-failed'\n\nexport class SkillInstallError extends InstallSourceError {\n declare readonly code: SkillInstallErrorCode\n /**\n * Frontmatter metadata per candidate, parallel to `candidates` — set on\n * the selector-less `multiple-candidates` error so host pickers can show\n * descriptions without re-fetching the source. Best-effort: candidates\n * whose SKILL.md fails to parse appear with no description.\n */\n readonly details?: readonly SkillCandidateDetail[]\n constructor(code: SkillInstallErrorCode, message: string, candidates?: readonly string[], details?: readonly SkillCandidateDetail[]) {\n super(code, message, candidates)\n this.name = 'SkillInstallError'\n if (details)\n this.details = details\n }\n}\n\n/** One pickable candidate surfaced to host UIs — see {@link SkillInstallError.details}. */\nexport interface SkillCandidateDetail {\n /** Root-relative path — the unambiguous selector (`skills` option). */\n rel: string\n /** Frontmatter description, when the candidate's SKILL.md parses. */\n description?: string\n}\n\nfunction rethrowAsSkillError(err: unknown): never {\n if (err instanceof InstallSourceError && !(err instanceof SkillInstallError))\n throw new SkillInstallError(err.code as SkillInstallErrorCode, err.message, err.candidates)\n throw err\n}\n\n// ---------------------------------------------------------------------------\n// Spec parsing (shared grammar + the skills.sh catalog URL form)\n// ---------------------------------------------------------------------------\n\nconst SKILLS_SH_URL_RE = /^(?:https?:\\/\\/)?(?:www\\.)?skills\\.sh\\/([\\w.-]+)\\/([\\w.-]+)(?:\\/([\\w.-]+))?\\/?$/\n\n/**\n * Pasted install commands, as printed by skill READMEs and skills.sh\n * pages — `npx skills add owner/repo`, `bunx skills add …`,\n * `pnpm dlx skills add … --skill x`, or a bare `skills add …`. The\n * runner + `add` verb are stripped and the remaining tokens re-enter\n * the normal grammar, so users can copy a whole command into the\n * install input verbatim.\n */\nconst SKILLS_CLI_COMMAND_RE = /^(?:(?:npx|bunx|yarn\\s+dlx|pnpm\\s+dlx)\\s+)?skills(?:@\\S+)?\\s+add\\s+(\\S.*)$/i\n\nexport interface SkillInstallSpec {\n source: InstallSource\n /**\n * Skill name selector for multi-skill sources. From a skills.sh URL's\n * third segment or the caller's explicit pick after a\n * `multiple-candidates` error.\n */\n skill?: string\n /**\n * The spec string to hand the `skills` CLI (its `add` argument).\n * skills.sh URLs pass through verbatim — the CLI understands them —\n * while parsed shorthand re-serializes to `owner/repo`.\n */\n cliSpec: string\n}\n\n/**\n * Parse a raw skill source. Accepts everything the shared grammar does\n * (`owner/repo[#ref][:subdir]`, GitHub URLs, `pkg@version`, …) plus\n * pasted skills.sh catalog URLs — `skills.sh/vercel-labs/agent-skills/\n * react-best-practices` maps to the backing GitHub repo with the third\n * segment as the skill selector.\n */\nexport function parseSkillInstallSpec(raw: string): SkillInstallSpec {\n const spec = raw.trim()\n const cliCommand = SKILLS_CLI_COMMAND_RE.exec(spec)\n if (cliCommand)\n return parseCliAddCommand(cliCommand[1] as string)\n const skillsSh = SKILLS_SH_URL_RE.exec(spec)\n if (skillsSh) {\n return {\n source: { kind: 'github', owner: skillsSh[1] as string, repo: skillsSh[2] as string },\n ...(skillsSh[3] ? { skill: skillsSh[3] } : {}),\n cliSpec: `${skillsSh[1]}/${skillsSh[2]}`,\n }\n }\n try {\n const source = parseInstallSource(spec)\n return { source, cliSpec: spec }\n }\n catch (err) {\n rethrowAsSkillError(err)\n }\n}\n\n/**\n * Parse the argument tail of a pasted `skills add …` command. Honors\n * `--skill <name>` / `--skill=<name>` (their per-skill selector — an\n * explicit selector in the URL/shorthand form wins over it), ignores\n * flags that are the dialog's job here (`-y`, `-g`, `--global`, …),\n * and routes the first non-flag token back through\n * {@link parseSkillInstallSpec} so URLs and shorthands inside the\n * command parse identically to a bare paste.\n */\nfunction parseCliAddCommand(rest: string): SkillInstallSpec {\n const tokens = rest.split(/\\s+/).filter(t => t.length > 0)\n let sourceToken: string | undefined\n let skill: string | undefined\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i] as string\n if (token === '--skill' || token === '-s') {\n skill = tokens[i + 1]\n i += 1\n continue\n }\n const inline = /^--skill=(.+)$/.exec(token)\n if (inline) {\n skill = inline[1] as string\n continue\n }\n if (token.startsWith('-'))\n continue\n if (sourceToken === undefined)\n sourceToken = token\n }\n if (sourceToken === undefined)\n throw new SkillInstallError('invalid-source', 'Pasted skills command has no source — expected “skills add <owner/repo>”.')\n const parsed = parseSkillInstallSpec(sourceToken)\n return { ...parsed, ...(skill !== undefined && parsed.skill === undefined ? { skill } : {}) }\n}\n\n// ---------------------------------------------------------------------------\n// Candidate enumeration + validation (data-only — no code execution)\n// ---------------------------------------------------------------------------\n\nexport interface SkillInstallCandidate {\n /** Directory name candidate (validated against SKILL.md frontmatter later). */\n name: string\n dir: string\n /**\n * Root-relative path (`engineering/tdd`) — the unambiguous selector\n * when the same skill NAME exists in several category directories.\n */\n rel: string\n}\n\n/**\n * How deep the candidate walk descends. Real-world collections nest\n * skills under category directories (`skills/engineering/tdd/SKILL.md`\n * in mattpocock/skills; `.github/skills/…` elsewhere) — one-level\n * enumeration missed all of them. Four levels covers every observed\n * layout while keeping the walk trivially bounded on the staged tree.\n */\nconst CANDIDATE_WALK_MAX_DEPTH = 4\n\n/**\n * List installable skills inside a fetched tree.\n *\n * A skill is ANY directory containing a `SKILL.md` — found by a\n * bounded recursive walk (depth {@link CANDIDATE_WALK_MAX_DEPTH}),\n * skipping dot-dirs and `node_modules`, and never descending INTO a\n * skill (its `references/` / `scripts/` subtree ships with it, it\n * doesn't nest further candidates). A root-level `SKILL.md` means\n * \"repo IS the skill\" and short-circuits, named from the fallback.\n *\n * Candidates carry their root-relative path (`rel`) so same-named\n * skills in different categories stay individually addressable.\n * Sorted by `rel`.\n */\nexport function listSkillCandidates(dir: string, fallbackName: string): SkillInstallCandidate[] {\n if (existsSync(join(dir, 'SKILL.md')))\n return [{ name: sanitizeName(fallbackName), dir, rel: '.' }]\n const out: SkillInstallCandidate[] = []\n const walk = (current: string, rel: string, depth: number): void => {\n if (depth > CANDIDATE_WALK_MAX_DEPTH)\n return\n for (const entry of readdirSync(current, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name === 'node_modules')\n continue\n const childDir = join(current, entry.name)\n const childRel = rel.length === 0 ? entry.name : `${rel}/${entry.name}`\n if (existsSync(join(childDir, 'SKILL.md')))\n out.push({ name: entry.name, dir: childDir, rel: childRel })\n else\n walk(childDir, childRel, depth + 1)\n }\n }\n walk(dir, '', 1)\n return out.sort((a, b) => a.rel.localeCompare(b.rel))\n}\n\n/**\n * Frontmatter details for a host picker, parallel to the candidate list.\n * Parsing is best-effort per candidate — a malformed SKILL.md yields a\n * detail row without a description rather than failing the enumeration.\n */\nasync function candidateDetails(candidates: readonly SkillInstallCandidate[]): Promise<SkillCandidateDetail[]> {\n return Promise.all(candidates.map(async (c) => {\n const parsed = await parseSkillFile(join(c.dir, 'SKILL.md')).catch(() => null)\n const description = parsed?.description.trim()\n return { rel: c.rel, ...(description ? { description } : {}) }\n }))\n}\n\n/** Human-readable candidate list for error messages — capped, rel-qualified when ambiguous. */\nfunction describeCandidates(candidates: readonly SkillInstallCandidate[]): string {\n const nameCounts = new Map<string, number>()\n for (const c of candidates)\n nameCounts.set(c.name, (nameCounts.get(c.name) ?? 0) + 1)\n const labels = candidates.map(c => ((nameCounts.get(c.name) ?? 0) > 1 ? c.rel : c.name))\n const shown = labels.slice(0, 20)\n const more = labels.length - shown.length\n return shown.join(', ') + (more > 0 ? `, … and ${more} more` : '')\n}\n\n/**\n * Validate a staged candidate by PARSING its SKILL.md — the same lenient\n * parser discovery runs, so \"installs cleanly\" and \"discovers cleanly\"\n * are the same predicate. Returns the frontmatter name (which wins over\n * the directory-derived candidate name for the target folder).\n */\nasync function validateSkillCandidate(candidate: SkillInstallCandidate): Promise<{ name: string }> {\n const parsed = await parseSkillFile(join(candidate.dir, 'SKILL.md'))\n if (!parsed)\n throw new SkillInstallError('validate-failed', `${candidate.dir}/SKILL.md is not a valid skill (missing name or description in frontmatter).`)\n const name = parsed.name\n if (!validateSkillName(name))\n throw new SkillInstallError('validate-failed', `Skill name \"${name}\" is invalid (lowercase alphanumerics + single hyphens, max 64 chars).`)\n return { name }\n}\n\n// ---------------------------------------------------------------------------\n// Install\n// ---------------------------------------------------------------------------\n\nexport interface SkillInstallOptions {\n /** Raw source spec — see {@link parseSkillInstallSpec} for the grammar. */\n source: string\n scope: InstallScope\n /** Pick one skill from a multi-skill source (names from the `multiple-candidates` error). */\n skill?: string\n /**\n * Install EVERY skill a multi-skill source contains (the affirmative\n * answer to the host's \"import all?\" prompt after a\n * `multiple-candidates` error). Native engine only — already-installed\n * names are skipped (reported via `SkillInstallResult.skipped`) rather\n * than failing the batch, unless `overwrite` is also set. Ignored when\n * a `skill` selector is present.\n */\n all?: boolean\n /**\n * Install a picked SUBSET of a multi-skill source — the host's checkbox\n * picker over the `multiple-candidates` list. Entries match a skill's\n * name or its root-relative path (same rules as `skill`); duplicates\n * collapse. Batch semantics mirror `all` (skip existing, pre-validate,\n * native engine). Takes precedence over `all` and is ignored when a\n * `skill` selector is present.\n */\n skills?: readonly string[]\n /** Overwrite an existing install of the same name. */\n overwrite?: boolean\n cwd?: string\n home?: string\n /** Storage prefix (default `.zidane`) — mirrors `ResolvedConfig.prefix`. */\n prefix?: string\n io?: InstallIo\n onProgress?: (message: string) => void\n /**\n * Prefer the skills.sh CLI when `skills` is on PATH (default true).\n * The CLI owns scope + layout decisions (`.agents/skills/`, their\n * lockfile); the native path is the fallback and the forced path in\n * tests. Set false to always install natively.\n */\n preferSkillsCli?: boolean\n}\n\nexport interface SkillInstallResult {\n /** Final skill name(s) installed. The CLI path reports the spec, not names. */\n installed: readonly string[]\n /** Names skipped during an `all` import because they were already installed. */\n skipped?: readonly string[]\n /** Candidate paths excluded from an `all` import because they failed validation. */\n failed?: readonly string[]\n /** Absolute target directory (native path only — the CLI owns its layout). */\n dir?: string\n /** `skills-cli` when delegated to the skills.sh CLI, else `native`. */\n engine: 'skills-cli' | 'native'\n provenance?: string\n}\n\n/**\n * Install a skill (or one skill out of a multi-skill source).\n *\n * Engine selection: targeted installs (an explicit skill selector) go\n * through the skills.sh CLI when present on PATH (unless\n * `preferSkillsCli: false`) — keeping their cross-agent layout and\n * lockfile — else the native fetch pipeline. Selector-less installs are\n * ALWAYS native: only native enumeration can tell single- from\n * multi-skill sources, and the host's \"import all?\" prompt rides on the\n * `multiple-candidates` error — delegating them to `skills add … -y`\n * would let the CLI's own multi-skill behavior silently decide instead.\n * `all: true` batches are native for the same reason (skip-existing +\n * per-skill provenance are our semantics).\n */\nexport async function installSkillFromSpec(opts: SkillInstallOptions): Promise<SkillInstallResult> {\n const io = opts.io ?? {}\n const which = io.which ?? defaultWhich\n const spec = parseSkillInstallSpec(opts.source)\n const skillSelector = opts.skill ?? spec.skill\n\n // Batch modes (`all` / `skills` subset) are always native — see JSDoc.\n const batchMode = opts.all === true || (opts.skills?.length ?? 0) > 0\n if (!batchMode && skillSelector !== undefined && (opts.preferSkillsCli ?? true) && which('skills'))\n return await installViaSkillsCli(spec, skillSelector, opts)\n\n return await installNatively(spec, skillSelector, opts)\n}\n\n/**\n * Delegate to the skills.sh CLI. Non-interactive by construction: `-y`\n * skips confirmation prompts, `-g` maps our `user` scope to their\n * global scope (project scope is their default, keyed off cwd). The CLI\n * decides the on-disk layout (`.agents/skills/`), which zidane's\n * discovery already scans.\n */\nasync function installViaSkillsCli(\n spec: SkillInstallSpec,\n skillSelector: string | undefined,\n opts: SkillInstallOptions,\n): Promise<SkillInstallResult> {\n const exec = opts.io?.exec ?? defaultExec\n const args = ['add', spec.cliSpec, '-y']\n if (skillSelector)\n args.push('--skill', skillSelector)\n if (opts.scope === 'user')\n args.push('-g')\n opts.onProgress?.(`skills add ${spec.cliSpec}${skillSelector ? ` --skill ${skillSelector}` : ''}…`)\n const res = await exec('skills', args, { cwd: opts.cwd ?? process.cwd() })\n if (!res.ok)\n throw new SkillInstallError('cli-failed', `skills.sh CLI failed: ${lastLine(res.stderr) || lastLine(res.stdout) || 'unknown error'}`)\n return {\n installed: [skillSelector ?? spec.cliSpec],\n engine: 'skills-cli',\n }\n}\n\nasync function installNatively(\n spec: SkillInstallSpec,\n skillSelector: string | undefined,\n opts: SkillInstallOptions,\n): Promise<SkillInstallResult> {\n const io = opts.io ?? {}\n const source = spec.source\n const stage = mkdtempSync(join(tmpdir(), 'zidane-skill-install-'))\n try {\n const fetchedInto = join(stage, 'fetched')\n mkdirSync(fetchedInto, { recursive: true })\n let provenance: string\n try {\n provenance = (await fetchInstallSource(source, fetchedInto, io, opts.onProgress)).provenance\n }\n catch (err) {\n rethrowAsSkillError(err)\n }\n\n // `:subdir` re-roots the search — same physical containment as\n // extensions (hostile symlinks must not walk out of the stage).\n let candidateRoot = fetchedInto\n let fallbackName = source.kind === 'github' ? source.repo : source.pkg\n if (source.kind === 'github' && source.subdir) {\n const rooted = resolveSubdirRoot(fetchedInto, source.subdir)\n if (!rooted.ok) {\n if (rooted.reason === 'missing')\n throw new SkillInstallError('no-skill', `\"${source.subdir}\" is not a directory in ${source.owner}/${source.repo}.`)\n throw new SkillInstallError('invalid-source', `Subdirectory \"${source.subdir}\" escapes the repository root${rooted.reason === 'escape-symlink' ? ' through a symlink' : ''}.`)\n }\n candidateRoot = rooted.dir\n fallbackName = basename(resolve(fetchedInto, source.subdir))\n }\n\n const candidates = listSkillCandidates(candidateRoot, fallbackName)\n if (candidates.length === 0)\n throw new SkillInstallError('no-skill', `No skill found in ${opts.source} — no SKILL.md anywhere in the tree (searched ${CANDIDATE_WALK_MAX_DEPTH} levels deep).`)\n let picked: SkillInstallCandidate[]\n if (!skillSelector && opts.skills && opts.skills.length > 0) {\n // Host-picked subset (checkbox picker over the `multiple-candidates`\n // list). Each entry resolves with the same name-or-rel-path rules as\n // the single selector; duplicate picks collapse to one install.\n const byRel = new Map<string, SkillInstallCandidate>()\n for (const sel of opts.skills) {\n const matches = candidates.filter(c => c.name === sel || c.rel === sel)\n if (matches.length === 0)\n throw new SkillInstallError('no-skill', `No skill named \"${sel}\" in ${opts.source}. Available: ${describeCandidates(candidates)}`, candidates.map(c => c.rel))\n if (matches.length > 1)\n throw new SkillInstallError('multiple-candidates', `\"${sel}\" is ambiguous in ${opts.source} — pick a path: ${matches.map(c => c.rel).join(', ')}`, matches.map(c => c.rel))\n const match = matches[0] as SkillInstallCandidate\n byRel.set(match.rel, match)\n }\n picked = [...byRel.values()]\n }\n else if (skillSelector) {\n // Selector matches the skill name OR its root-relative path — the\n // path form disambiguates same-named skills in different category\n // directories (`engineering/tdd` vs `personal/tdd`).\n const matches = candidates.filter(c => c.name === skillSelector || c.rel === skillSelector)\n if (matches.length === 0)\n throw new SkillInstallError('no-skill', `No skill named \"${skillSelector}\" in ${opts.source}. Available: ${describeCandidates(candidates)}`, candidates.map(c => c.rel))\n if (matches.length > 1)\n throw new SkillInstallError('multiple-candidates', `\"${skillSelector}\" is ambiguous in ${opts.source} — pick a path: ${matches.map(c => c.rel).join(', ')}`, matches.map(c => c.rel))\n picked = [matches[0] as SkillInstallCandidate]\n }\n else if (candidates.length > 1 && !opts.all) {\n throw new SkillInstallError(\n 'multiple-candidates',\n `${opts.source} contains ${candidates.length} skills — pick one: ${describeCandidates(candidates)}`,\n candidates.map(c => c.rel),\n await candidateDetails(candidates),\n )\n }\n else {\n picked = [...candidates]\n }\n\n const root = scopeRoot(opts)\n const installed: string[] = []\n const skipped: string[] = []\n const failed: string[] = []\n let lastDir: string | undefined\n const batch = picked.length > 1\n\n // Validate the whole batch BEFORE installing anything — one malformed\n // candidate must not abort a half-applied import. Batch mode collects\n // failures (reported via `SkillInstallResult.failed`) and installs the\n // rest; a targeted single install keeps the hard throw.\n const resolved: Array<{ candidate: SkillInstallCandidate, name: string }> = []\n // Intra-batch name conflicts: two candidates whose frontmatter\n // validates to the same name (`engineering/tdd` + `personal/tdd`)\n // would otherwise install the first and mislabel the second as\n // \"already installed\" (or, with overwrite, silently last-wins).\n // First occurrence wins; later ones are reported as conflicts.\n const nameToRel = new Map<string, string>()\n for (const candidate of picked) {\n try {\n // Frontmatter name wins over the directory-derived candidate name —\n // mirrors \"target folder is named from the VALIDATED definition\".\n const { name } = await validateSkillCandidate(candidate)\n const conflict = nameToRel.get(name)\n if (conflict !== undefined) {\n // Only reachable in batch mode — a single pick can't conflict.\n failed.push(candidate.rel)\n opts.onProgress?.(`skipping \"${candidate.rel}\" — name \"${name}\" conflicts with \"${conflict}\"`)\n continue\n }\n nameToRel.set(name, candidate.rel)\n resolved.push({ candidate, name })\n }\n catch (err) {\n if (!batch)\n throw err\n failed.push(candidate.rel)\n opts.onProgress?.(`skipping \"${candidate.rel}\" — ${errorMessage(err)}`)\n }\n }\n\n for (const { candidate, name } of resolved) {\n const targetDir = join(root, name)\n const backupDir = `${targetDir}.zidane-backup`\n if (existsSync(targetDir) && !opts.overwrite) {\n // Batch imports skip collisions (already-installed skills are the\n // common case when re-importing a repo); a targeted single install\n // keeps the hard error so the overwrite decision stays explicit.\n if (batch) {\n skipped.push(name)\n opts.onProgress?.(`skipping \"${name}\" — already installed`)\n continue\n }\n throw new SkillInstallError('exists', `Skill \"${name}\" is already installed at ${targetDir}. Overwrite to replace it.`)\n }\n\n mkdirSync(root, { recursive: true })\n const hadPrevious = existsSync(targetDir)\n if (hadPrevious) {\n rmSync(backupDir, { recursive: true, force: true })\n renameSync(targetDir, backupDir)\n }\n try {\n // `dereference` materializes in-tree symlinked files so the install\n // has no dangling links once the stage is deleted.\n cpSync(candidate.dir, targetDir, { recursive: true, dereference: true })\n writeProvenance(targetDir, { spec: opts.source, ...(skillSelector ? { skill: skillSelector } : {}), scope: opts.scope, provenance, installedAt: Date.now() })\n }\n catch (err) {\n rmSync(targetDir, { recursive: true, force: true })\n if (hadPrevious)\n renameSync(backupDir, targetDir)\n throw new SkillInstallError('io-failed', `Writing ${targetDir} failed: ${errorMessage(err)}`)\n }\n rmSync(backupDir, { recursive: true, force: true })\n installed.push(name)\n lastDir = targetDir\n if (batch)\n opts.onProgress?.(`installed \"${name}\" (${installed.length}/${resolved.length})`)\n }\n\n if (installed.length === 0 && skipped.length > 0)\n throw new SkillInstallError('exists', `All ${skipped.length} installable skills from ${opts.source} are already installed: ${skipped.join(', ')}. Overwrite to replace them.`)\n if (installed.length === 0 && failed.length > 0)\n throw new SkillInstallError('validate-failed', `No skill from ${opts.source} was installable — invalid: ${failed.join(', ')}.`)\n\n return {\n installed,\n ...(skipped.length > 0 ? { skipped } : {}),\n ...(failed.length > 0 ? { failed } : {}),\n ...(lastDir !== undefined ? { dir: lastDir } : {}),\n engine: 'native',\n provenance,\n }\n }\n finally {\n rmSync(stage, { recursive: true, force: true })\n }\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n/** Provenance sidecar — lets a future update flow replay the recorded spec. */\nexport const SKILL_PROVENANCE_FILE = '.zidane-install.json'\n\ninterface SkillProvenance {\n spec: string\n skill?: string\n scope: InstallScope\n provenance: string\n installedAt: number\n}\n\nfunction writeProvenance(dir: string, data: SkillProvenance): void {\n writeFileSync(join(dir, SKILL_PROVENANCE_FILE), `${JSON.stringify(data, null, 2)}\\n`)\n}\n\n/** Read a skill directory's install provenance, `null` for hand-authored skills. */\nexport function readSkillProvenance(dir: string): (SkillProvenance & { spec: string }) | null {\n try {\n const raw = JSON.parse(readFileSync(join(dir, SKILL_PROVENANCE_FILE), 'utf8')) as Partial<SkillProvenance>\n return typeof raw.spec === 'string' && raw.spec.length > 0 ? (raw as SkillProvenance) : null\n }\n catch {\n return null\n }\n}\n\n/**\n * Native-install target root: the `<prefix>/skills` flavor of the\n * project/user convention (`~/.zidane/skills`, `<gitRoot>/.zidane/skills`).\n * The `.agents/skills` siblings stay read-only for us — they belong to\n * the cross-agent ecosystem (and the skills.sh CLI writes there).\n */\nfunction scopeRoot(opts: SkillInstallOptions): string {\n const roots = projectUserPaths({\n subPath: 'skills',\n ...(opts.cwd ? { cwd: opts.cwd } : {}),\n ...(opts.home ? { home: opts.home } : {}),\n ...(opts.prefix ? { prefix: opts.prefix } : {}),\n })\n const root = roots.find(r => r.source === opts.scope && r.path.includes(`.${(opts.prefix ?? '.zidane').replace(/^\\./, '')}`))\n if (!root)\n throw new SkillInstallError('io-failed', `No ${opts.scope} skills root resolved.`)\n return root.path\n}\n\nfunction sanitizeName(raw: string): string {\n const cleaned = raw.toLowerCase().replace(/[^a-z0-9-]+/g, '-').replace(/^-+|-+$/g, '').replace(/-{2,}/g, '-')\n return cleaned.length > 0 ? cleaned : 'skill'\n}\n","import type { SkillConfig } from './types'\nimport { validateSkillForWrite } from './validate'\n\nexport {\n type ActivationVia,\n type ActiveSkill,\n createSkillActivationState,\n type DeactivationReason,\n type SkillActivationState,\n type SkillActivationStateOptions,\n} from './activation'\nexport {\n IMPLICITLY_ALLOWED_SKILL_TOOLS,\n installAllowedToolsGate,\n} from './allowed-tools'\nexport { buildCatalog } from './catalog'\nexport {\n discoverSkills,\n getDefaultScanPaths,\n inferSource,\n parseFrontmatter,\n parseSkillFile,\n} from './discovery'\nexport type { SourcedScanPath } from './discovery'\nexport {\n installSkillFromSpec,\n listSkillCandidates,\n parseSkillInstallSpec,\n readSkillProvenance,\n SKILL_PROVENANCE_FILE,\n SkillInstallError,\n} from './install'\nexport type {\n SkillCandidateDetail,\n SkillInstallCandidate,\n SkillInstallErrorCode,\n SkillInstallOptions,\n SkillInstallResult,\n SkillInstallSpec,\n} from './install'\nexport { interpolateShellCommands, stripShellInterpolations } from './interpolate'\nexport type { InterpolateShellCommandsOptions } from './interpolate'\nexport { resolveSkills } from './resolve'\nexport type {\n ShellInterpolationApproval,\n SkillConfig,\n SkillDiagnostic,\n SkillResource,\n SkillsConfig,\n SkillSource,\n} from './types'\nexport {\n isToolAllowedByUnion,\n matchesAllowedTool,\n parseAllowedToolPattern,\n validateResourcePath,\n validateResourcePathReal,\n validateSkillForWrite,\n validateSkillName,\n} from './validate'\nexport type { SkillValidationIssue, SkillValidationResult } from './validate'\nexport { writeSkillsToDisk, writeSkillToDisk } from './writer'\n\n// ---------------------------------------------------------------------------\n// defineSkill helper\n// ---------------------------------------------------------------------------\n\n/**\n * Define an inline skill configuration.\n *\n * Strict-validates at author-time — throws if the config would be rejected by\n * `writeSkillToDisk` or the spec. Source defaults to `'inline'`.\n */\nexport function defineSkill(config: Omit<SkillConfig, 'source'> & { source?: SkillConfig['source'] }): SkillConfig {\n const normalized: SkillConfig = {\n ...config,\n source: config.source ?? 'inline',\n }\n const result = validateSkillForWrite(normalized)\n if (!result.valid) {\n const summary = result.errors.map(e => ` - [${e.code}] ${e.message}`).join('\\n')\n throw new Error(`Invalid skill \"${normalized.name}\":\\n${summary}`)\n }\n return normalized\n}\n"],"mappings":";;;;;;AAwDA,IAAa,oBAAb,cAAuC,mBAAmB;;;;;;;CAQxD;CACA,YAAY,MAA6B,SAAiB,YAAgC,SAA2C;EACnI,MAAM,MAAM,SAAS,UAAU;EAC/B,KAAK,OAAO;EACZ,IAAI,SACF,KAAK,UAAU;CACnB;AACF;AAUA,SAAS,oBAAoB,KAAqB;CAChD,IAAI,eAAe,sBAAsB,EAAE,eAAe,oBACxD,MAAM,IAAI,kBAAkB,IAAI,MAA+B,IAAI,SAAS,IAAI,UAAU;CAC5F,MAAM;AACR;AAMA,MAAM,mBAAmB;;;;;;;;;AAUzB,MAAM,wBAAwB;;;;;;;;AAyB9B,SAAgB,sBAAsB,KAA+B;CACnE,MAAM,OAAO,IAAI,KAAK;CACtB,MAAM,aAAa,sBAAsB,KAAK,IAAI;CAClD,IAAI,YACF,OAAO,mBAAmB,WAAW,EAAY;CACnD,MAAM,WAAW,iBAAiB,KAAK,IAAI;CAC3C,IAAI,UACF,OAAO;EACL,QAAQ;GAAE,MAAM;GAAU,OAAO,SAAS;GAAc,MAAM,SAAS;EAAa;EACpF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,IAAI,MAAM,kBAAkB,WAAW,KAAK,MAAM,SAAS;CACnE;CACA,OAAO;AACT"}
package/dist/skills.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $s as SkillInstallSpec, Bs as validateResourcePathReal, Fs as SkillValidationResult, Gs as interpolateShellCommands, Hs as validateSkillName, Is as isToolAllowedByUnion, Js as SkillInstallCandidate, Ks as stripShellInterpolations, Ls as matchesAllowedTool, Ms as writeSkillToDisk, Ns as writeSkillsToDisk, Ps as SkillValidationIssue, Qs as SkillInstallResult, Rs as parseAllowedToolPattern, Us as resolveSkills, Vs as validateSkillForWrite, Ws as InterpolateShellCommandsOptions, Xs as SkillInstallErrorCode, Ys as SkillInstallError, Zs as SkillInstallOptions, _c as SkillActivationStateOptions, ac as discoverSkills, ap as SkillDiagnostic, cc as parseFrontmatter, cp as SkillsConfig, dc as IMPLICITLY_ALLOWED_SKILL_TOOLS, ec as installSkillFromSpec, fc as installAllowedToolsGate, gc as SkillActivationState, hc as DeactivationReason, ic as SourcedScanPath, ip as SkillConfig, js as defineSkill, lc as parseSkillFile, mc as ActiveSkill, nc as parseSkillInstallSpec, oc as getDefaultScanPaths, op as SkillResource, pc as ActivationVia, qs as SKILL_PROVENANCE_FILE, rc as readSkillProvenance, rp as ShellInterpolationApproval, sc as inferSource, sp as SkillSource, tc as listSkillCandidates, uc as buildCatalog, vc as createSkillActivationState, zs as validateResourcePath } from "./index-CNyYEOy0.js";
2
- export { type ActivationVia, type ActiveSkill, type DeactivationReason, IMPLICITLY_ALLOWED_SKILL_TOOLS, type InterpolateShellCommandsOptions, SKILL_PROVENANCE_FILE, type ShellInterpolationApproval, type SkillActivationState, type SkillActivationStateOptions, type SkillConfig, type SkillDiagnostic, type SkillInstallCandidate, SkillInstallError, type SkillInstallErrorCode, type SkillInstallOptions, type SkillInstallResult, type SkillInstallSpec, type SkillResource, type SkillSource, type SkillValidationIssue, type SkillValidationResult, type SkillsConfig, type SourcedScanPath, buildCatalog, createSkillActivationState, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, installSkillFromSpec, interpolateShellCommands, isToolAllowedByUnion, listSkillCandidates, matchesAllowedTool, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, parseSkillInstallSpec, readSkillProvenance, resolveSkills, stripShellInterpolations, validateResourcePath, validateResourcePathReal, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
1
+ import { $s as SkillInstallResult, Bs as validateResourcePathReal, Fs as SkillValidationResult, Gs as interpolateShellCommands, Hs as validateSkillName, Is as isToolAllowedByUnion, Js as SkillCandidateDetail, Ks as stripShellInterpolations, Ls as matchesAllowedTool, Ms as writeSkillToDisk, Ns as writeSkillsToDisk, Ps as SkillValidationIssue, Qs as SkillInstallOptions, Rs as parseAllowedToolPattern, Us as resolveSkills, Vs as validateSkillForWrite, Ws as InterpolateShellCommandsOptions, Xs as SkillInstallError, Ys as SkillInstallCandidate, Zs as SkillInstallErrorCode, _c as SkillActivationState, ac as SourcedScanPath, ap as SkillConfig, cc as inferSource, cp as SkillSource, dc as buildCatalog, ec as SkillInstallSpec, fc as IMPLICITLY_ALLOWED_SKILL_TOOLS, gc as DeactivationReason, hc as ActiveSkill, ic as readSkillProvenance, ip as ShellInterpolationApproval, js as defineSkill, lc as parseFrontmatter, lp as SkillsConfig, mc as ActivationVia, nc as listSkillCandidates, oc as discoverSkills, op as SkillDiagnostic, pc as installAllowedToolsGate, qs as SKILL_PROVENANCE_FILE, rc as parseSkillInstallSpec, sc as getDefaultScanPaths, sp as SkillResource, tc as installSkillFromSpec, uc as parseSkillFile, vc as SkillActivationStateOptions, yc as createSkillActivationState, zs as validateResourcePath } from "./index-BFNt9GAs.js";
2
+ export { type ActivationVia, type ActiveSkill, type DeactivationReason, IMPLICITLY_ALLOWED_SKILL_TOOLS, type InterpolateShellCommandsOptions, SKILL_PROVENANCE_FILE, type ShellInterpolationApproval, type SkillActivationState, type SkillActivationStateOptions, type SkillCandidateDetail, type SkillConfig, type SkillDiagnostic, type SkillInstallCandidate, SkillInstallError, type SkillInstallErrorCode, type SkillInstallOptions, type SkillInstallResult, type SkillInstallSpec, type SkillResource, type SkillSource, type SkillValidationIssue, type SkillValidationResult, type SkillsConfig, type SourcedScanPath, buildCatalog, createSkillActivationState, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, installSkillFromSpec, interpolateShellCommands, isToolAllowedByUnion, listSkillCandidates, matchesAllowedTool, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, parseSkillInstallSpec, readSkillProvenance, resolveSkills, stripShellInterpolations, validateResourcePath, validateResourcePathReal, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
package/dist/skills.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { A as validateSkillName, C as stripShellInterpolations, D as validateResourcePath, E as parseAllowedToolPattern, O as validateResourcePathReal, S as interpolateShellCommands, T as matchesAllowedTool, a as getDefaultScanPaths, c as parseSkillFile, d as installAllowedToolsGate, f as createSkillActivationState, i as discoverSkills, k as validateSkillForWrite, l as buildCatalog, n as writeSkillToDisk, o as inferSource, r as writeSkillsToDisk, s as parseFrontmatter, t as resolveSkills, u as IMPLICITLY_ALLOWED_SKILL_TOOLS, w as isToolAllowedByUnion } from "./resolve-HtxmBWs9.js";
2
- import { a as listSkillCandidates, i as installSkillFromSpec, n as SKILL_PROVENANCE_FILE, o as parseSkillInstallSpec, r as SkillInstallError, s as readSkillProvenance, t as defineSkill } from "./skills-BlmY7QhV.js";
2
+ import { a as listSkillCandidates, i as installSkillFromSpec, n as SKILL_PROVENANCE_FILE, o as parseSkillInstallSpec, r as SkillInstallError, s as readSkillProvenance, t as defineSkill } from "./skills-CDpejYOf.js";
3
3
  export { IMPLICITLY_ALLOWED_SKILL_TOOLS, SKILL_PROVENANCE_FILE, SkillInstallError, buildCatalog, createSkillActivationState, defineSkill, discoverSkills, getDefaultScanPaths, inferSource, installAllowedToolsGate, installSkillFromSpec, interpolateShellCommands, isToolAllowedByUnion, listSkillCandidates, matchesAllowedTool, parseAllowedToolPattern, parseFrontmatter, parseSkillFile, parseSkillInstallSpec, readSkillProvenance, resolveSkills, stripShellInterpolations, validateResourcePath, validateResourcePathReal, validateSkillForWrite, validateSkillName, writeSkillToDisk, writeSkillsToDisk };
@@ -1,4 +1,4 @@
1
- import { Qu as ProviderKey, Ru as Settings, Zu as ProviderAuth, nd as ModelInfo, zu as StreamEvent } from "./index-CNyYEOy0.js";
1
+ import { $u as ProviderKey, Bu as StreamEvent, Qu as ProviderAuth, rd as ModelInfo, zu as Settings } from "./index-BFNt9GAs.js";
2
2
  import { ReactNode } from "react";
3
3
 
4
4
  //#region src/chat/turn-selection.d.ts
@@ -432,4 +432,4 @@ declare function displayNameFor(name: string, input?: Record<string, unknown>):
432
432
  declare function formatToolCall(name: string, input: Record<string, unknown>): ToolFormatLine | null;
433
433
  //#endregion
434
434
  export { turnSelectionOwnership as A, useSafeModeActions as C, isTurnHighlighted as D, isEditErrorResult as E, isVisible as O, SafeModeProvider as S, EDIT_TOOL_NAMES as T, splitMarkdownCodeBlocks as _, formatToolCall as a, RequestApproval as b, splitPromptSegments as c, filterModelCatalog as d, indexOfEntry as f, normalizeMarkdownCodeFences as g, chunkMarkdownForRender as h, displayNameFor as i, selectableTurnIds as k, CatalogEntry as l, MarkdownSegment as m, ToolDisplayMeta as n, PromptSegment as o, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as p, ToolFormatLine as r, PromptSegmentRef as s, TOOL_DISPLAY as t, buildModelCatalog as u, ApprovalDecision as v, useSafeModeQueue as w, SafeModeActions as x, ApprovalRequest as y };
435
- //# sourceMappingURL=tool-formatters-B7oWiy5m.d.ts.map
435
+ //# sourceMappingURL=tool-formatters-B_zQsYfa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-formatters-B7oWiy5m.d.ts","names":[],"sources":["../src/chat/turn-selection.ts","../src/chat/safe-mode-context.tsx","../src/chat/markdown-segments.ts","../src/chat/model-catalog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C;;;;;;;;;iBIzLgB,mBAAA,CACd,IAAA,UACA,IAAA,WAAe,gBAAA,KACd,aAAa;;;;;;;AJ9ChB;;;;AAAyC;AAmBzC;;;;AAA8C;AAqE9C;;;UKjFiB,cAAA;ELiFgB;;;;;EK3E/B,MAAA;ELsIc;;;;;EKhId,IAAI;AAAA;AAAA,UAGW,eAAA;EL6H0D;AAiD3E;;;;;;;;EKpKE,WAAA,aAAwB,KAAA,EAAO,MAAA;ELqKnB;;;;;EK/JZ,MAAA,GAAS,KAAA,EAAO,MAAA,sBAA4B,cAAA;AAAA;AAAA,cAOjC,YAAA,EAAc,QAAA,CAAS,MAAA,SAAe,eAAA;;;;;;;;;ALyL9B;;;;AChNrB;;;iBIoUgB,cAAA,CACd,IAAA,UACA,KAAA,GAAQ,MAAM;AJjUa;AAQ7B;;;;;AAR6B,iBImVb,cAAA,CAAe,IAAA,UAAc,KAAA,EAAO,MAAA,oBAA0B,cAAc"}
1
+ {"version":3,"file":"tool-formatters-B_zQsYfa.d.ts","names":[],"sources":["../src/chat/turn-selection.ts","../src/chat/safe-mode-context.tsx","../src/chat/markdown-segments.ts","../src/chat/model-catalog.ts","../src/chat/prompt-segments.ts","../src/chat/tool-formatters.ts"],"mappings":";;;;;cAaa,eAAA,EAAiB,WAAW;;AAAzC;;;;AAAyC;AAmBzC;;;;AAA8C;AAqE9C;;;;;;iBArEgB,iBAAA,CAAkB,IAAY;;;;;;;AAoLN;AA6BxC;;;;;;iBA5IgB,SAAA,CAAU,KAAA,EAAO,WAAA,EAAa,QAAA,EAAU,QAAQ;;;AA8I3C;;;;AChNrB;;;;AAK6B;AAQ7B;;;;;;;;AAE4B;AAE5B;;;;;;;iBD4GgB,sBAAA,CAAuB,MAAA,WAAiB,WAAA,KAAgB,GAAG;;;;;;;;;;;ACtG1C;iBDuJjB,iBAAA,CACd,KAAA,EAAO,IAAA,CAAK,WAAA,aACZ,cAAA,iBACA,SAAA,EAAW,WAAA;;;;;;;;;;;;;;;;;AClJg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AR6B,iBImVb,cAAA,CAAe,IAAA,UAAc,KAAA,EAAO,MAAA,oBAA0B,cAAc"}
@@ -1,4 +1,4 @@
1
- import { Kf as ToolDef } from "../index-CNyYEOy0.js";
1
+ import { qf as ToolDef } from "../index-BFNt9GAs.js";
2
2
 
3
3
  //#region src/tools/fetch-url.d.ts
4
4
  declare function isBlockedAddress(ip: string): boolean;
@@ -1,4 +1,4 @@
1
- import { Kf as ToolDef } from "../index-CNyYEOy0.js";
1
+ import { qf as ToolDef } from "../index-BFNt9GAs.js";
2
2
 
3
3
  //#region src/tools/web-search.d.ts
4
4
  declare const webSearch: ToolDef;
package/dist/tools.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $f as hydrateReadStateFromSession, $n as waitTask, As as matchModelEntries, Cr as glob, Cs as SubagentOverride, Ds as SpawnModelEntry, Es as isSpawnTool, Gf as ToolContext, Jf as HydrateReadStateOptions, Kf as ToolDef, Os as createModelSearchTool, Qf as hashContent, Qn as WAIT_TASK_TIMED_OUT_PREFIX, Sr as grep, Ss as SubagentDef, Ts as createSpawnTool, Xf as ReadStateMap, Yf as ReadStateEntry, Zf as getReadState, Zn as writeFile, _r as readFile, _s as SpawnTaskInput, ar as ToolSearchToolOptions, br as InteractionToolOptions, bs as SpawnToolOptions, cr as createSkillsUseTool, dr as SkillsReadToolOptions, ep as hydrateReadStateFromSessionAsync, er as ValidationResult, fr as createSkillsReadTool, gr as shell, gs as ExtensionSubagentDef, hr as createShellTool, hs as ChildAgent, ir as LazyToolEntry, ks as formatModelLine, lr as SkillsRunScriptToolOptions, mr as CreateShellToolOptions, np as resolveReadStateMap, nr as TailTruncateOptions, or as createToolSearchTool, pr as shellKill, qf as ToolMap, rr as tailTruncate, sr as SkillsUseToolOptions, tp as readStateKey, tr as validateToolArgs, ur as createSkillsRunScriptTool, vr as multiEdit, vs as SpawnTaskOutcome, wr as edit, ws as SubagentRegistry, xr as createInteractionTool, xs as SpawnToolState, yr as listFiles, ys as SpawnTool } from "./index-CNyYEOy0.js";
1
+ import { $f as hashContent, $n as waitTask, As as matchModelEntries, Cr as glob, Cs as SubagentOverride, Ds as SpawnModelEntry, Es as isSpawnTool, Jf as ToolMap, Kf as ToolContext, Os as createModelSearchTool, Qf as getReadState, Qn as WAIT_TASK_TIMED_OUT_PREFIX, Sr as grep, Ss as SubagentDef, Ts as createSpawnTool, Xf as ReadStateEntry, Yf as HydrateReadStateOptions, Zf as ReadStateMap, Zn as writeFile, _r as readFile, _s as SpawnTaskInput, ar as ToolSearchToolOptions, br as InteractionToolOptions, bs as SpawnToolOptions, cr as createSkillsUseTool, dr as SkillsReadToolOptions, ep as hydrateReadStateFromSession, er as ValidationResult, fr as createSkillsReadTool, gr as shell, gs as ExtensionSubagentDef, hr as createShellTool, hs as ChildAgent, ir as LazyToolEntry, ks as formatModelLine, lr as SkillsRunScriptToolOptions, mr as CreateShellToolOptions, np as readStateKey, nr as TailTruncateOptions, or as createToolSearchTool, pr as shellKill, qf as ToolDef, rp as resolveReadStateMap, rr as tailTruncate, sr as SkillsUseToolOptions, tp as hydrateReadStateFromSessionAsync, tr as validateToolArgs, ur as createSkillsRunScriptTool, vr as multiEdit, vs as SpawnTaskOutcome, wr as edit, ws as SubagentRegistry, xr as createInteractionTool, xs as SpawnToolState, yr as listFiles, ys as SpawnTool } from "./index-BFNt9GAs.js";
2
2
  export { type ChildAgent, type CreateShellToolOptions, type ExtensionSubagentDef, type HydrateReadStateOptions, type InteractionToolOptions, type LazyToolEntry, type ReadStateEntry, type ReadStateMap, type SkillsReadToolOptions, type SkillsRunScriptToolOptions, type SkillsUseToolOptions, type SpawnModelEntry, type SpawnTaskInput, type SpawnTaskOutcome, type SpawnTool, type SpawnToolOptions, type SpawnToolState, type SubagentDef, type SubagentOverride, type SubagentRegistry, type TailTruncateOptions, type ToolContext, type ToolDef, type ToolMap, type ToolSearchToolOptions, type ValidationResult, WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createModelSearchTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, formatModelLine, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, matchModelEntries, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
package/dist/tools.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as hydrateReadStateFromSessionAsync, c as resolveReadStateMap, i as hydrateReadStateFromSession, r as hashContent, s as readStateKey, t as getReadState } from "./read-state-Dq_TXUX1.js";
2
- import { At as createInteractionTool, Ct as readFile, Dt as formatModelLine, Et as createModelSearchTool, Mt as glob, Nt as edit, Ot as matchModelEntries, Pt as validateToolArgs, St as tailTruncate, Tt as multiEdit, _t as createSkillsRunScriptTool, bt as createShellTool, dt as WAIT_TASK_TIMED_OUT_PREFIX, ft as waitTask, gt as createSkillsUseTool, ht as isSpawnTool, jt as grep, kt as listFiles, mt as createSpawnTool, pt as createToolSearchTool, ut as writeFile, vt as createSkillsReadTool, xt as shell, yt as shellKill } from "./agent-D11SxCvA.js";
2
+ import { At as createInteractionTool, Ct as readFile, Dt as formatModelLine, Et as createModelSearchTool, Mt as glob, Nt as edit, Ot as matchModelEntries, Pt as validateToolArgs, St as tailTruncate, Tt as multiEdit, _t as createSkillsRunScriptTool, bt as createShellTool, dt as WAIT_TASK_TIMED_OUT_PREFIX, ft as waitTask, gt as createSkillsUseTool, ht as isSpawnTool, jt as grep, kt as listFiles, mt as createSpawnTool, pt as createToolSearchTool, ut as writeFile, vt as createSkillsReadTool, xt as shell, yt as shellKill } from "./agent-6iGNP46b.js";
3
3
  export { WAIT_TASK_TIMED_OUT_PREFIX, createInteractionTool, createModelSearchTool, createShellTool, createSkillsReadTool, createSkillsRunScriptTool, createSkillsUseTool, createSpawnTool, createToolSearchTool, edit, formatModelLine, getReadState, glob, grep, hashContent, hydrateReadStateFromSession, hydrateReadStateFromSessionAsync, isSpawnTool, listFiles, matchModelEntries, multiEdit, readFile, readStateKey, resolveReadStateMap, shell, shellKill, tailTruncate, validateToolArgs, waitTask, writeFile };
@@ -1,16 +1,16 @@
1
1
  import { l as toolResultToText } from "./types-BIarq1qE.js";
2
- import { Ct as readFile$1, Ft as resolveStorageDirs, Gt as mergeKeybindings, Jt as readKeybindingsRaw, Mt as glob, Nt as edit, R as EMPTY_EXTENSION_REGISTRY, Tt as multiEdit, Yt as resolveExtensionKeybindings, Z as buildExtensionPreset, ft as waitTask, jt as grep, kt as listFiles, mt as createSpawnTool, ot as composePresets, st as definePreset, ut as writeFile$1, xt as shell, yt as shellKill } from "./agent-D11SxCvA.js";
3
- import { c as previewLine, i as fmtTokens, l as shortId } from "./format-BF745pLL.js";
2
+ import { Ct as readFile$1, Ft as resolveStorageDirs, Gt as mergeKeybindings, Jt as readKeybindingsRaw, Mt as glob, Nt as edit, R as EMPTY_EXTENSION_REGISTRY, Tt as multiEdit, Yt as resolveExtensionKeybindings, Z as buildExtensionPreset, ft as waitTask, jt as grep, kt as listFiles, mt as createSpawnTool, ot as composePresets, st as definePreset, ut as writeFile$1, xt as shell, yt as shellKill } from "./agent-6iGNP46b.js";
3
+ import { a as formatDuration, c as previewLine, i as fmtTokens, l as shortId } from "./format-BF745pLL.js";
4
4
  import { l as errorMessage } from "./errors-DJUxZg9b.js";
5
5
  import { M as findGitRoot$1, i as discoverSkills, j as projectUserPaths } from "./resolve-HtxmBWs9.js";
6
6
  import { t as writeFileAtomic } from "./atomic-write-B7zr1ddF.js";
7
7
  import { r as formatTokenUsage } from "./stats-DAKBEKjc.js";
8
8
  import { joinSystemPrompt } from "./prompt.js";
9
- import { a as normalizeMcpServers, n as connectMcpServers } from "./mcp-CkHUripi.js";
9
+ import { a as normalizeMcpServers, n as connectMcpServers } from "./mcp-BCaN_Gyg.js";
10
10
  import { i as findActiveTriggers, n as collectReferences, o as mergeSuggestions, t as applyInsert } from "./completion-core-BRo86R_L.js";
11
11
  import { r as fetchUrl } from "./fetch-url-_5WKWpbQ.js";
12
12
  import { webSearch } from "./tools/web-search.js";
13
- import { C as restoreModelOptions, l as BUILTIN_PROVIDERS, n as applyApiKeyEnv, r as credentialsPath, t as detectAuth, v as modelSupportsReasoning, y as modelsForDescriptor } from "./auth-Ys_7TmRj.js";
13
+ import { C as restoreModelOptions, l as BUILTIN_PROVIDERS, n as applyApiKeyEnv, r as credentialsPath, t as detectAuth, v as modelSupportsReasoning, y as modelsForDescriptor } from "./auth-BH6G59RL.js";
14
14
  import { ct as chatReferenceTokensFromText, nt as parseEditOutcomesFromResult, p as ownerOf, q as extractEditPayload, u as capTranscriptEvents } from "./turn-operations-CXjRaltC.js";
15
15
  import { createRequire } from "node:module";
16
16
  import { dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
@@ -246,6 +246,26 @@ function eventsFromTurns(turns, runs = []) {
246
246
  }
247
247
  return chain;
248
248
  };
249
+ const childRunsOf = /* @__PURE__ */ new Map();
250
+ for (const run of runById.values()) {
251
+ if (!run.parentRunId) continue;
252
+ const siblings = childRunsOf.get(run.parentRunId) ?? [];
253
+ siblings.push(run);
254
+ childRunsOf.set(run.parentRunId, siblings);
255
+ }
256
+ const subtreeCost = (root) => {
257
+ let total = 0;
258
+ const queue = [root];
259
+ const seen = /* @__PURE__ */ new Set();
260
+ while (queue.length > 0) {
261
+ const run = queue.pop();
262
+ if (seen.has(run.id)) continue;
263
+ seen.add(run.id);
264
+ total += run.cost ?? run.turnUsage?.reduce((sum, u) => sum + (u.cost ?? 0), 0) ?? 0;
265
+ queue.push(...childRunsOf.get(run.id) ?? []);
266
+ }
267
+ return total;
268
+ };
249
269
  const events = [];
250
270
  /** Currently-open child runs, root-of-tree first, innermost last. */
251
271
  const openStack = [];
@@ -259,9 +279,12 @@ function eventsFromTurns(turns, runs = []) {
259
279
  totalCacheRead: run.totalUsage?.cacheRead ?? 0,
260
280
  totalCacheCreation: run.totalUsage?.cacheCreation ?? 0
261
281
  });
282
+ const elapsed = run.endedAt !== void 0 ? ` · ${formatDuration(run.endedAt - run.startedAt)}` : "";
283
+ const cost = subtreeCost(run);
284
+ const segments = `${elapsed}${cost > 0 ? ` · $${cost.toFixed(cost < .01 ? 4 : 2)}` : ""}`;
262
285
  events.push({
263
286
  kind: "spawn-end",
264
- text: `${tag} ${usage}`,
287
+ text: segments ? `${tag}${segments} · ${usage}` : `${tag} ${usage}`,
265
288
  childId: labelFor(run.id),
266
289
  depth: run.depth ?? 1
267
290
  });
@@ -5036,6 +5059,7 @@ const DEFAULT_SETTINGS = {
5036
5059
  showFullShellOutput: false,
5037
5060
  safeMode: true,
5038
5061
  loadProjectExtensions: false,
5062
+ importForeignConfigs: false,
5039
5063
  hideSubagentOutput: true,
5040
5064
  subagentModels: true,
5041
5065
  theme: DEFAULT_THEME.id,
@@ -5175,6 +5199,12 @@ const SETTINGS_TOGGLES = [
5175
5199
  label: "Load project extensions",
5176
5200
  description: "run extensions under <project>/.zidane/extensions — off by default (they execute arbitrary local code)"
5177
5201
  },
5202
+ {
5203
+ category: "agent",
5204
+ key: "importForeignConfigs",
5205
+ label: "Import configurations from other agents",
5206
+ description: "discover MCP servers + skills from Claude Code, Codex, and Pi configs (project + user) — imported stdio servers execute commands from files zidane does not own"
5207
+ },
5178
5208
  {
5179
5209
  category: "agent",
5180
5210
  key: "attachmentsEnabled",
@@ -7082,6 +7112,174 @@ function isCachedEntry(value) {
7082
7112
  return true;
7083
7113
  }
7084
7114
  //#endregion
7115
+ //#region src/chat/foreign-configs.ts
7116
+ function roots(opts) {
7117
+ const cwd = opts.cwd ?? process.cwd();
7118
+ return {
7119
+ projectRoot: findGitRoot$1(cwd) ?? cwd,
7120
+ home: opts.home ?? homedir()
7121
+ };
7122
+ }
7123
+ /**
7124
+ * MCP config files other agents maintain, project entries first.
7125
+ * Returned regardless of existence — callers `existsSync`-filter, same
7126
+ * contract as `defaultMcpsConfigPaths`.
7127
+ */
7128
+ function foreignMcpConfigFiles(opts = {}) {
7129
+ const { projectRoot, home } = roots(opts);
7130
+ return [
7131
+ {
7132
+ path: resolve(projectRoot, ".mcp.json"),
7133
+ source: "project",
7134
+ format: "json"
7135
+ },
7136
+ {
7137
+ path: resolve(home, ".claude.json"),
7138
+ source: "project",
7139
+ format: "claude-project-state"
7140
+ },
7141
+ {
7142
+ path: resolve(projectRoot, ".pi/mcps.json"),
7143
+ source: "project",
7144
+ format: "json"
7145
+ },
7146
+ {
7147
+ path: resolve(projectRoot, ".pi/mcp.json"),
7148
+ source: "project",
7149
+ format: "json"
7150
+ },
7151
+ {
7152
+ path: resolve(home, ".claude.json"),
7153
+ source: "user",
7154
+ format: "claude-user-state"
7155
+ },
7156
+ {
7157
+ path: resolve(home, ".codex/config.toml"),
7158
+ source: "user",
7159
+ format: "codex-toml"
7160
+ },
7161
+ {
7162
+ path: resolve(home, ".pi/agent/mcps.json"),
7163
+ source: "user",
7164
+ format: "json"
7165
+ },
7166
+ {
7167
+ path: resolve(home, ".pi/agent/mcp.json"),
7168
+ source: "user",
7169
+ format: "json"
7170
+ }
7171
+ ];
7172
+ }
7173
+ /**
7174
+ * Skill directories other agents maintain, project entries first. Feed
7175
+ * directly into `discoverSkills` — the SKILL.md format is shared across
7176
+ * the ecosystem, so foreign skills parse with the same lenient loader.
7177
+ */
7178
+ function foreignSkillScanPaths(opts = {}) {
7179
+ const { projectRoot, home } = roots(opts);
7180
+ return [
7181
+ {
7182
+ path: resolve(projectRoot, ".claude/skills"),
7183
+ source: "project"
7184
+ },
7185
+ {
7186
+ path: resolve(projectRoot, ".codex/skills"),
7187
+ source: "project"
7188
+ },
7189
+ {
7190
+ path: resolve(projectRoot, ".pi/skills"),
7191
+ source: "project"
7192
+ },
7193
+ {
7194
+ path: resolve(home, ".claude/skills"),
7195
+ source: "user"
7196
+ },
7197
+ {
7198
+ path: resolve(home, ".codex/skills"),
7199
+ source: "user"
7200
+ },
7201
+ {
7202
+ path: resolve(home, ".pi/agent/skills"),
7203
+ source: "user"
7204
+ }
7205
+ ];
7206
+ }
7207
+ /**
7208
+ * Parse the two foreign-only formats. The `json` format is NOT handled
7209
+ * here — callers route it through the shared `parseMcpsFile` (keeping
7210
+ * whitespace sanitizing + error hints in one place, and avoiding an
7211
+ * import cycle with `mcps-discovery`).
7212
+ */
7213
+ function parseForeignMcpConfig(text, format, opts = {}) {
7214
+ if (format === "codex-toml") return parseCodexToml(text);
7215
+ if (format === "claude-project-state") return parseClaudeProjectState(text, opts.projectRoot);
7216
+ return parseClaudeUserState(text);
7217
+ }
7218
+ /**
7219
+ * `~/.claude.json` → `projects["<abs project root>"].mcpServers` — the
7220
+ * per-project servers `claude mcp add` writes in its default "local"
7221
+ * scope. Exact-match on the resolved project root: Claude keys by the
7222
+ * directory it was launched from, which for repo work is the git root
7223
+ * we resolve to.
7224
+ */
7225
+ function parseClaudeProjectState(text, projectRoot) {
7226
+ if (!projectRoot) return [];
7227
+ const raw = JSON.parse(text);
7228
+ const projects = raw && typeof raw === "object" ? raw.projects : void 0;
7229
+ if (!projects || typeof projects !== "object") return [];
7230
+ return normalizeForeignEntries(projects[projectRoot]?.mcpServers);
7231
+ }
7232
+ /**
7233
+ * `~/.claude.json` — Claude Code's user-state file. Import ONLY the
7234
+ * `mcpServers` map; absent/malformed key means "nothing to import"
7235
+ * rather than an error, since the file legitimately exists without it.
7236
+ */
7237
+ function parseClaudeUserState(text) {
7238
+ const raw = JSON.parse(text);
7239
+ return normalizeForeignEntries(raw && typeof raw === "object" ? raw.mcpServers : void 0);
7240
+ }
7241
+ /**
7242
+ * Normalize a name-keyed server map ENTRY BY ENTRY, skipping the ones
7243
+ * `normalizeMcpServers` rejects (no inferrable transport, exotic shapes).
7244
+ * Whole-file normalization would let one bad entry drop every server in
7245
+ * a file the user doesn't own — and can't fix from zidane.
7246
+ */
7247
+ function normalizeForeignEntries(servers) {
7248
+ if (!servers || typeof servers !== "object" || Array.isArray(servers)) return [];
7249
+ const out = [];
7250
+ for (const [name, entry] of Object.entries(servers)) try {
7251
+ out.push(...normalizeMcpServers({ [name]: entry }));
7252
+ } catch {}
7253
+ return out;
7254
+ }
7255
+ /**
7256
+ * `~/.codex/config.toml` — `[mcp_servers.<name>]` tables. TOML parsing
7257
+ * rides Bun's built-in parser; on a non-Bun host the Codex import is
7258
+ * silently unavailable (returns `[]`) rather than pulling in a TOML
7259
+ * dependency for one optional file. Only the fields our config
7260
+ * understands are forwarded — Codex-specific extras
7261
+ * (`startup_timeout_ms`, …) are dropped before normalization.
7262
+ */
7263
+ function parseCodexToml(text) {
7264
+ const toml = globalThis.Bun?.TOML;
7265
+ if (!toml) return [];
7266
+ const parsed = toml.parse(text);
7267
+ const tables = parsed && typeof parsed === "object" ? parsed.mcp_servers : void 0;
7268
+ if (!tables || typeof tables !== "object" || Array.isArray(tables)) return [];
7269
+ const map = {};
7270
+ for (const [name, entry] of Object.entries(tables)) {
7271
+ if (!entry || typeof entry !== "object") continue;
7272
+ const raw = entry;
7273
+ map[name] = {
7274
+ ...raw.command !== void 0 ? { command: raw.command } : {},
7275
+ ...raw.args !== void 0 ? { args: raw.args } : {},
7276
+ ...raw.env !== void 0 ? { env: raw.env } : {},
7277
+ ...raw.url !== void 0 ? { url: raw.url } : {}
7278
+ };
7279
+ }
7280
+ return normalizeForeignEntries(map);
7281
+ }
7282
+ //#endregion
7085
7283
  //#region src/chat/mcps-discovery.ts
7086
7284
  /**
7087
7285
  * File names searched in each of the four project/user roots. Order
@@ -7259,14 +7457,16 @@ function isEntryDisabled(entry) {
7259
7457
  * log line is also emitted for ops visibility.
7260
7458
  */
7261
7459
  function discoverProjectMcps(opts = {}) {
7262
- const paths = defaultMcpsConfigPaths(opts).filter((p) => existsSync(p.path));
7460
+ const paths = mcpsDiscoveryPaths(opts).filter((p) => existsSync(p.path));
7461
+ const projectRoot = findGitRoot$1(opts.cwd ?? process.cwd()) ?? opts.cwd ?? process.cwd();
7263
7462
  const seen = /* @__PURE__ */ new Set();
7264
7463
  const servers = [];
7265
7464
  const errors = [];
7266
- for (const { path, source } of paths) {
7465
+ for (const { path, source, format } of paths) {
7267
7466
  let configs;
7268
7467
  try {
7269
- configs = parseMcpsFile(readFileSync(path, "utf8"));
7468
+ const text = readFileSync(path, "utf8");
7469
+ configs = format === "json" ? parseMcpsFile(text) : parseForeignMcpConfig(text, format, { projectRoot });
7270
7470
  } catch (err) {
7271
7471
  const message = errorMessage(err);
7272
7472
  errors.push({
@@ -7293,6 +7493,20 @@ function discoverProjectMcps(opts = {}) {
7293
7493
  };
7294
7494
  }
7295
7495
  /**
7496
+ * Full path list a discovery pass reads, formats attached — native
7497
+ * `mcp(s).json` locations first (they win name collisions), then the
7498
+ * foreign-agent files when enabled. Exported so the TUI's config-file
7499
+ * watcher can stat the exact same set the discovery reads.
7500
+ */
7501
+ function mcpsDiscoveryPaths(opts = {}) {
7502
+ const native = defaultMcpsConfigPaths(opts).map((p) => ({
7503
+ ...p,
7504
+ format: "json"
7505
+ }));
7506
+ if (!opts.foreignAgents) return native;
7507
+ return [...native, ...foreignMcpConfigFiles(opts)];
7508
+ }
7509
+ /**
7296
7510
  * Map a user-toggled enable list onto the `mcpServers` array the agent
7297
7511
  * receives. Conventions match `buildSkillsConfig`:
7298
7512
  *
@@ -8340,10 +8554,12 @@ function aggregateUsage(runs) {
8340
8554
  * `discoverSkills` itself skips missing dirs without error.
8341
8555
  */
8342
8556
  function defaultSkillScanPaths(opts = {}) {
8343
- return projectUserPaths({
8557
+ const native = projectUserPaths({
8344
8558
  subPath: "skills",
8345
8559
  ...opts
8346
8560
  });
8561
+ if (!opts.foreignAgents) return native;
8562
+ return [...native, ...foreignSkillScanPaths(opts)];
8347
8563
  }
8348
8564
  /**
8349
8565
  * Discover every skill reachable from the default scan paths. Returns
@@ -8821,6 +9037,6 @@ function computeTurnAnchors(items) {
8821
9037
  };
8822
9038
  }
8823
9039
  //#endregion
8824
- export { useMcpAuthState as $, buildPlanSystem as $n, restoreChainFallbacks as $t, runOAuthLogin as A, TODOWRITE_TOOL as An, DEFAULT_THEME as At, saveMcpToolsCache as B, setTodosForRun as Bn, createDiscoverySlot as Bt, projectsFilePath as C, DEFAULT_PERSIST_EXCLUDE_TOOLS as Cn, SETTINGS_CHOICES as Ct, formatPathForCwd as D, singleAgentRegistry as Dn, clampFps as Dt, writeProjects as E, resolveAgentId as En, SettingsProvider as Et, parseMcpsFile as F, getTodosForRun as Fn, GRUVBOX_LIGHT as Ft, buildVisibleMcpRows as G, IDENTITY_PREFIX as Gn, useConfig as Gt, buildToolToggle as H, ACTIONS_WITH_CARE_DOCTRINE as Hn, useDiscovery as Ht, clearMcpToolsCache as I, isTodoTool as In, CATPPUCCIN_FRAPPE as It, createFileMcpCredentialStore as J, PLAN_MODE_DOCTRINE as Jn, buildRunModel as Jt, indexOfServerRow as K, INTERACTION_GUIDANCE as Kn, resolveConfig as Kt, loadMcpToolsCache as L, pickActiveRunId as Ln, CATPPUCCIN_LATTE as Lt, buildMcpServers as M, TODO_WRITE_COUNTS_METADATA_KEY as Mn, resolveTheme as Mt, defaultMcpsConfigPaths as N, createTodoTools as Nn, VAPORWAVE_THEME as Nt, fetchOAuthRedirect as O, TODOREAD_TOOL as On, useSettings as Ot, discoverProjectMcps as P, getArchivedTodosForRun as Pn, GRUVBOX_DARK as Pt, useMcpAuthDispatch as Q, buildBuildSystem as Qn, providerKeySetChanged as Qt, mcpToolsCachePath as R, pruneTodosByRun as Rn, CATPPUCCIN_MACCHIATO as Rt, matchesSafelistEntry as S, DEFAULT_BUDGET_EXCLUDE_TOOLS as Sn, SETTINGS_CATEGORIES as St, suggestSafelistEntries as T, accentColor as Tn, SETTINGS_TOGGLES as Tt, useMcpToolToggleMap as U, COMMUNICATION_DOCTRINE as Un, useDiscoveryOptional as Ut, subscribeMcpToolsCache as V, useActiveTodos as Vn, DiscoveryProvider as Vt, useMcpToolToggleSet as W, DOING_TASKS_DOCTRINE as Wn, ConfigProvider as Wt, patchMcpCredential as X, SUBAGENT_GUIDANCE as Xn, chainsEqual as Xt, mcpCredentialsPath as Y, PLAN_MODE_DOCTRINE_NO_PROMPTS as Yn, chainPositionOf as Yt, McpAuthProvider as Z, TOKEN_DISCIPLINE_DOCTRINE as Zn, filterChainFallbacks as Zt, useSafeModeQueue as _, discoverAgentsMd as _n, toolCallPreview as _r, buildHints as _t, useSurfaces as a, bootTick as an, createStateStore as ar, buildResumedToolResultsTurn as at, getSafelist as b, BUILTIN_AGENTS as bn, usageByModel as br, useEnabledToggleSet as bt, useStreamBuffer as c, checkForUpdate as cn, lastContextSizeFromTurns as cr, makeRequestInteraction as ct, discoverProjectSkills as d, detectPackageManager as dn, marginTopFor as dr, useInteractionsActions as dt, sanitizeModelChain as en, envSection as er, getMcpAuthStatus as et, renderSession as f, parseSemver as fn, saveState as fr, useInteractionsQueue as ft, useSafeModeActions as g, chatAutoCompactBehavior as gn, titleFromTurns as gr, truncateTrailing as gt, SafeModeProvider as h, resolvePlatformPackage as hn, sumRunCosts as hr, hintsLength as ht, useSelectStyle as i, bootProfileEnabled as in, compactSummaryEvent as ir, PRESENT_PLAN_TOOL as it, supportsOAuth as j, TODO_STATUS_GLYPHS as jn, resolveChipColor as jt, oauthUsesManualCodePaste as k, TODOS_METADATA_KEY as kn, BUILTIN_THEMES as kt, buildSkillsConfig as l, compareSemver as ln, listSessionMeta as lr, pendingInteractionsFromTurns as lt, writeSessionExport as m, performSelfUpdate as mn, stripSpawnTokensLine as mr, clipHintsToWidth as mt, ThemeProvider as n, useCompletion as nn, createChatTurnsReadTool as nr, ASK_USER_TOOL as nt, useSyntaxStyles as o, buildUpdateHint as on, deriveSessionTitle as or, createInteractionTools as ot, resolveSessionExportTarget as p, performInPlaceSelfUpdate as pn, serverToolResultSummary as pr, EMPTY_HINTS as pt, parentServerName as q, INTERACTION_GUIDANCE_NO_PROMPTS as qn, resolveStoragePaths as qt, useColors as r, tryOpenBrowser as rn, DEFAULT_SESSION_TITLE as rr, InteractionsProvider as rt, useTheme as s, useUpdateCheck as sn, eventsFromTurns as sr, isInteractionTool as st, computeTurnAnchors as t, toggleChainEntry as tn, chatReferenceTokensForPrompt as tr, reduceMcpAuth as tt, defaultSkillScanPaths as u, detectLibc as un, loadState as ur, serializeInteractionResponse as ut, IMPLICITLY_SAFE_TOOLS as v, renderAgentsMdBlock as vn, toolResultText as vr, shortChord as vt, readProjects as w, PLAN_AGENT as wn, SETTINGS_INPUTS as wt, isOnSafelist as x, DEFAULT_AGENT_ID as xn, DEFAULT_SETTINGS as xt, addToSafelist as y, BUILD_AGENT as yn, updateToolEventOutcomes as yr, listProjectFiles as yt, refreshMcpToolsCatalog as z, selectActiveTodos as zn, CATPPUCCIN_MOCHA as zt };
9040
+ export { useMcpAuthDispatch as $, buildBuildSystem as $n, providerKeySetChanged as $t, runOAuthLogin as A, TODOS_METADATA_KEY as An, BUILTIN_THEMES as At, refreshMcpToolsCatalog as B, selectActiveTodos as Bn, CATPPUCCIN_MOCHA as Bt, projectsFilePath as C, DEFAULT_BUDGET_EXCLUDE_TOOLS as Cn, SETTINGS_CATEGORIES as Ct, formatPathForCwd as D, resolveAgentId as Dn, SettingsProvider as Dt, writeProjects as E, accentColor as En, SETTINGS_TOGGLES as Et, mcpsDiscoveryPaths as F, getArchivedTodosForRun as Fn, GRUVBOX_DARK as Ft, useMcpToolToggleSet as G, DOING_TASKS_DOCTRINE as Gn, ConfigProvider as Gt, subscribeMcpToolsCache as H, useActiveTodos as Hn, DiscoveryProvider as Ht, parseMcpsFile as I, getTodosForRun as In, GRUVBOX_LIGHT as It, parentServerName as J, INTERACTION_GUIDANCE_NO_PROMPTS as Jn, resolveStoragePaths as Jt, buildVisibleMcpRows as K, IDENTITY_PREFIX as Kn, useConfig as Kt, clearMcpToolsCache as L, isTodoTool as Ln, CATPPUCCIN_FRAPPE as Lt, buildMcpServers as M, TODO_STATUS_GLYPHS as Mn, resolveChipColor as Mt, defaultMcpsConfigPaths as N, TODO_WRITE_COUNTS_METADATA_KEY as Nn, resolveTheme as Nt, fetchOAuthRedirect as O, singleAgentRegistry as On, clampFps as Ot, discoverProjectMcps as P, createTodoTools as Pn, VAPORWAVE_THEME as Pt, McpAuthProvider as Q, TOKEN_DISCIPLINE_DOCTRINE as Qn, filterChainFallbacks as Qt, loadMcpToolsCache as R, pickActiveRunId as Rn, CATPPUCCIN_LATTE as Rt, matchesSafelistEntry as S, DEFAULT_AGENT_ID as Sn, DEFAULT_SETTINGS as St, suggestSafelistEntries as T, PLAN_AGENT as Tn, SETTINGS_INPUTS as Tt, buildToolToggle as U, ACTIONS_WITH_CARE_DOCTRINE as Un, useDiscovery as Ut, saveMcpToolsCache as V, setTodosForRun as Vn, createDiscoverySlot as Vt, useMcpToolToggleMap as W, COMMUNICATION_DOCTRINE as Wn, useDiscoveryOptional as Wt, mcpCredentialsPath as X, PLAN_MODE_DOCTRINE_NO_PROMPTS as Xn, chainPositionOf as Xt, createFileMcpCredentialStore as Y, PLAN_MODE_DOCTRINE as Yn, buildRunModel as Yt, patchMcpCredential as Z, SUBAGENT_GUIDANCE as Zn, chainsEqual as Zt, useSafeModeQueue as _, chatAutoCompactBehavior as _n, titleFromTurns as _r, truncateTrailing as _t, useSurfaces as a, bootProfileEnabled as an, compactSummaryEvent as ar, PRESENT_PLAN_TOOL as at, getSafelist as b, BUILD_AGENT as bn, updateToolEventOutcomes as br, listProjectFiles as bt, useStreamBuffer as c, useUpdateCheck as cn, eventsFromTurns as cr, isInteractionTool as ct, discoverProjectSkills as d, detectLibc as dn, loadState as dr, serializeInteractionResponse as dt, restoreChainFallbacks as en, buildPlanSystem as er, useMcpAuthState as et, renderSession as f, detectPackageManager as fn, marginTopFor as fr, useInteractionsActions as ft, useSafeModeActions as g, resolvePlatformPackage as gn, sumRunCosts as gr, hintsLength as gt, SafeModeProvider as h, performSelfUpdate as hn, stripSpawnTokensLine as hr, clipHintsToWidth as ht, useSelectStyle as i, tryOpenBrowser as in, DEFAULT_SESSION_TITLE as ir, InteractionsProvider as it, supportsOAuth as j, TODOWRITE_TOOL as jn, DEFAULT_THEME as jt, oauthUsesManualCodePaste as k, TODOREAD_TOOL as kn, useSettings as kt, buildSkillsConfig as l, checkForUpdate as ln, lastContextSizeFromTurns as lr, makeRequestInteraction as lt, writeSessionExport as m, performInPlaceSelfUpdate as mn, serverToolResultSummary as mr, EMPTY_HINTS as mt, ThemeProvider as n, toggleChainEntry as nn, chatReferenceTokensForPrompt as nr, reduceMcpAuth as nt, useSyntaxStyles as o, bootTick as on, createStateStore as or, buildResumedToolResultsTurn as ot, resolveSessionExportTarget as p, parseSemver as pn, saveState as pr, useInteractionsQueue as pt, indexOfServerRow as q, INTERACTION_GUIDANCE as qn, resolveConfig as qt, useColors as r, useCompletion as rn, createChatTurnsReadTool as rr, ASK_USER_TOOL as rt, useTheme as s, buildUpdateHint as sn, deriveSessionTitle as sr, createInteractionTools as st, computeTurnAnchors as t, sanitizeModelChain as tn, envSection as tr, getMcpAuthStatus as tt, defaultSkillScanPaths as u, compareSemver as un, listSessionMeta as ur, pendingInteractionsFromTurns as ut, IMPLICITLY_SAFE_TOOLS as v, discoverAgentsMd as vn, toolCallPreview as vr, buildHints as vt, readProjects as w, DEFAULT_PERSIST_EXCLUDE_TOOLS as wn, SETTINGS_CHOICES as wt, isOnSafelist as x, BUILTIN_AGENTS as xn, usageByModel as xr, useEnabledToggleSet as xt, addToSafelist as y, renderAgentsMdBlock as yn, toolResultText as yr, shortChord as yt, mcpToolsCachePath as z, pruneTodosByRun as zn, CATPPUCCIN_MACCHIATO as zt };
8825
9041
 
8826
- //# sourceMappingURL=transcript-anchors-cc4gsU-j.js.map
9042
+ //# sourceMappingURL=transcript-anchors-BUigMBQt.js.map