@agentyx/adapters

中文文档
0.24.0发布于 2026/10/26MITTypeScriptES Module近 30 天下载 3347

Provider adapters, MCP rendering and safe install planning for Agentyx.

原始使用文档
文档目录4 节
  1. Targets
  2. Plan first, then write
  3. Writing an adapter
  4. Safety

@agentyx/adapters

Provider adapters for Agentyx: the layer that turns an already-resolved Agentyx environment into the files a specific coding agent expects.

Agentyx packs, skills, MCP definitions, and tool checks describe development environments, never providers, so everything a provider knows lives here rather than in @agentyx/core. This package depends on core; core never depends on it.

Targets

IdAgentProject skill destination
codexCodex.agents/skills
claudeClaude Code.claude/skills
kimiKimi Code.agents/skills
qwenQwen Code.qwen/skills

Every destination is the provider's documented project-local convention: Codex reads repository skills from the vendor-neutral .agents/skills, Claude Code from .claude/skills, Kimi Code also scans project .agents/skills, and Qwen Code from .qwen/skills. Installation is project-local — nothing is written to $HOME.

Plan first, then write

import { applyInstallPlans, planInstall } from "@agentyx/adapters";
import { builtInSkillRegistry } from "@agentyx/core";

const skills = ["planning", "angular-modern"].map((name) => builtInSkillRegistry.get(name));

// Reads the destinations to classify each file, and writes nothing.
const plans = await planInstall({
  targets: ["codex", "claude", "kimi", "qwen"],
  projectDir,
  skills,
});

// The only code in Agentyx that mutates a project. Skipping it is a dry run.
await applyInstallPlans(plans);

A plan is a list of write-file operations, each with a create / update / unchanged status, an absolute path and the project-relative path used for output. Parent directories are created by the executor, so there is no directory operation; there is no operation that runs a command.

Every target is handed the same SkillDefinition objects and the canonical SKILL.md that @agentyx/core renders, so providers can only ever receive identical instructions. Providers that share the same destination and content, such as Codex and Kimi Code, collapse to one physical write with shared usedBy metadata.

Writing an adapter

An adapter is a plain object satisfying AgentAdapter: an id, a name, the directory it owns, detect, and a pure planFiles that maps resolved skills to desired files. Comparing them with what is installed and writing them is shared machinery.

import { createAdapterRegistry, createSkillDirectoryAdapter } from "@agentyx/adapters";

const acme = createSkillDirectoryAdapter({
  id: "acme",
  name: "Acme Agent",
  skillsDir: [".acme", "skills"],
  reference: "https://example.invalid/skills",
});

const registry = createAdapterRegistry([acme]);

createSkillDirectoryAdapter covers any agent that reads <directory>/<skill>/SKILL.md; a genuinely different layout implements AgentAdapter directly. There is no dynamic package loading and no remote registry — an adapter is a value you pass in.

Safety

Agentyx only manages <destination>/<skill>/SKILL.md for skills it resolved, <agents dir>/<agent>.md (or .toml) for agents it resolved, and the MCP server and hook keys it added to a provider project config. A plan that would write outside the directory or project file a target owns is refused with InstallPathError, including project-local paths redirected through symlinks. Unchanged files are not rewritten, writes are UTF-8, and nothing is executed, fetched, or installed globally.

Project MCP configuration, project hooks and project agents are planned and written through the same plan-first machinery. Adapters receive only active definitions; pack and optional-capability resolution stays in core. Permissions and user-global configuration are not part of the contract: Agentyx never writes under $HOME, which is why a provider whose hooks are user-level only — Kimi Code — gets no hook installation at all.

When one provider document carries several capabilities, it is still one write. Qwen Code reads both mcpServers and hooks from .qwen/settings.json, so the planner composes the two merges into a single operation and the lock records a single settings entry naming both the servers and the hooks; two independent merges of one file would each be planned from a stale read, and the second write would drop the first.

Prune and uninstall act only on paths, MCP server keys and hook names recorded in .agentyx.lock.json. A file whose current content no longer matches the manifest hash is reported as a conflict and left alone unless the caller explicitly chooses --force.

MIT © Andersseen

版本与发布记录

@agentyx/adapters 共发布 28 个版本,首次发布于 2026/08/09;过去 12 个月发布了 28 个版本。

版本发布日期距今
0.24.0latest2026/10/2612 天前
0.23.02026/10/2513 天前
0.22.02026/10/2217 天前
0.21.02026/10/2117 天前
0.20.02026/10/1523 天前
0.19.02026/10/1523 天前

关于 @agentyx/adapters 的常见问题

@agentyx/adapters 是什么?

Provider adapters, MCP rendering and safe install planning for Agentyx.

如何安装 @agentyx/adapters?

在项目目录运行 npm install @agentyx/adapters,或使用 pnpm add / yarn add / bun add。

@agentyx/adapters 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@agentyx/adapters 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agentyx/adapters 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agentyx/adapters 可以商用吗?

@agentyx/adapters 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agentyx/adapters 的下载量有多少?

根据 npm 官方下载统计,@agentyx/adapters 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,347 次,日均约 112 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agentyx/adapters 还在维护吗?

最新版本 0.24.0 发布于 2026/10/26(12 天前);至今共发布 28 个版本,其中过去 12 个月发布了 28 个;首次发布于 2026/08/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。