@felan-ai/ext-claude-code

中文文档
0.4.1发布于 2026/11/12MITTypeScriptES Module构建来源已验证近 30 天下载 2335

Claude Code plan-backed model provider for Felan

原始使用文档
文档目录7 节
  1. Requirements and setup
  2. Models
  3. Settings
  4. Compatibility and limitations
  5. Debugging
  6. Development
  7. Attribution

@felan-ai/ext-claude-code

Use Claude models in Felan through Claude Code and your Claude plan login. Felan keeps the agent loop, conversation, tools, approvals, and user interface. Claude Code runs as the model transport through Anthropic's Agent SDK; an in-process MCP server exposes Felan's tools to Claude. The bridge mirrors Felan history into Claude Code sessions so resumed requests see the same conversation. No Claude Code companion modification is required.

Requirements and setup

  • A macOS or Linux Felan host. Non-host runtimes and Windows are not supported.
  • npm on the host's PATH for the managed installation.
  • Claude Code installed and signed in on that machine with a compatible Claude plan. Run claude, then /login, before using this provider.

In Felan:

  1. Run /claude-code install and approve the host's installation request. This downloads Claude Agent SDK 0.3.322 and its approximately 330 MB per-platform binary. Linux downloads both glibc and musl variants, roughly 640 MB in total. Anthropic's Agent SDK license and terms apply; the SDK and Claude Code are not bundled with this MIT-licensed package.
  2. Start a new session or reload to load the provider.
  3. Use /model claude-code/<model-id>, for example /model claude-code/claude-opus-5-5, or select a claude-code model in /model.
  4. Run /claude-code status to inspect the SDK version, whether the provider is registered in this session, and the resolved plan and long-context settings.

/claude-code without arguments also shows status. Unknown arguments show usage. Installation delegates { id: 'claude-code' } to the optional RUNTIME_DEPENDENCIES_SERVICE; authorization belongs to the trusted local Felan host. Without that service, status remains available but installation is disabled. Activation only inspects and loads an existing installation: it never installs anything, executes npm, or downloads files. A missing or unloadable SDK is logged through the runtime logger and leaves the provider unregistered. Inspection also reports a previously installed SDK version when the required version is missing. On local interactive startup, Felan offers an update for an enabled provider that needs a newer SDK, even if dependency onboarding was completed before. Installation requires confirmation. Leaving it unchanged records that choice for the required version; cancelling records no choice. Disabled providers are not offered updates. Activation then starts Claude Code without a prompt to read its model list (see Models).

The managed SDK and its pinned dependencies live under <agent-storage>/claude-code/agent-sdk-0.3.322. The generated ESM entry loads both the Agent SDK and the MCP implementation from that installation. Host providers can import inspectClaudeCodeRuntime, installManagedClaudeAgentSdk, managedClaudeAgentSdkDirectory, and MANAGED_CLAUDE_AGENT_SDK_VERSION from this package. The installer helper does not perform authorization itself.

Installation uses a committed, reviewed lockfile with integrity hashes and npm ci --ignore-scripts. Completed installs are verified in staging, including the host's platform and libc-matched binary, before being moved into place. A valid installation is never removed or replaced; reinstalling it is a no-op. npm registry and proxy configuration still applies, but integrity is enforced. See Runtime dependencies.

Models

The provider registers the Agent Core Anthropic catalog models that Claude Code lists in its own /model picker for your login. That list depends on the Claude Code version, your plan, and managed availableModels and deniedModels settings. A catalog model Claude Code does not list, such as a model newer than the pinned Claude Code, is not registered. A model Claude Code lists but the catalog lacks is not registered either; it appears after an Agent Core update. Dated snapshot aliases are omitted.

The first activation in a Felan process asks Claude Code for the list, which takes about 0.25 seconds warm and 2 seconds on a cold start; later sessions reuse the answer until the process restarts or inheritAnthropicEnvironment or pathToClaudeCodeExecutable changes. If Claude Code returns an error or does not answer within 20 seconds, the warning is logged, the provider stays unregistered in that session, and the next session asks again. Callers of activateClaudeCodeBridge pass the list from claudeCodeSupportedModels.

Claude Code receives most of its /model lineup, including older and newly rolled-out models, through its telemetry service. The model-list probe therefore runs with Claude Code telemetry enabled; error reporting, the autoupdater and the bug command stay disabled, and conversation turns keep CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1. Set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 or DISABLE_TELEMETRY=1 in Felan's environment to keep the probe's telemetry off as well; Claude Code then lists only its base models.

Models keep the catalog's Anthropic API prices, so session cost in the footer and usage reports is an API-equivalent estimate at list prices, including Claude Code's 1-hour cache writes. It is not your bill: usage is charged against your Claude plan limits and Extra Usage, not these rates. Plan usage events are forwarded as anthropic-ratelimit-unified-* response headers for compatible footer extensions.

Settings

Use /settings, or edit extensionConfig["claude-code"] in $FELAN_AGENT_DIR/settings.json:

{
  "extensionConfig": {
    "claude-code": {
      "plan": "pro",
      "longContextExtraUsage": false,
      "forceTwoHundredK": [],
      "strictMcpConfig": true,
      "autoMemoryEnabled": false,
      "inheritAnthropicEnvironment": false
    }
  }
}
SettingDefaultPurpose
plan"pro""pro" or "max"; controls plan-gated long-context availability, not authentication.
longContextExtraUsagefalseEnable long-context models that may consume paid Extra Usage.
forceTwoHundredK[]Array of model IDs to pin to 200K context; omit claude-code/ and [1m].
strictMcpConfigtrueExclude local Claude Code MCP configurations; use Felan's tools. Claude.ai-connected MCP servers are always disabled.
autoMemoryEnabledfalseEnable Claude Code's own auto-memory in addition to Felan's memory.
pathToClaudeCodeExecutableunsetOptional absolute path to claude, instead of the SDK's bundled binary.
inheritAnthropicEnvironmentfalsePreserve exported ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_BASE_URL in the Claude Code child. By default only these three variables are removed.

Other Claude Code variables still pass through, including CLAUDE_CODE_OAUTH_TOKEN, CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, ANTHROPIC_MODEL, and ANTHROPIC_CUSTOM_HEADERS. They can change authentication, model selection, or request destination even when inheritAnthropicEnvironment is false.

Invalid types, unknown fields, invalid plan values, non-string array entries, and relative executable paths are rejected. Changes take effect on activation in a new session or reload. Bridge settings are process-wide: in a shared daemon, the latest activation supplies settings for subsequent calls.

Long-context support is model-specific. Fable 5.2 uses the 1M context shown in Claude Code and requests claude-fable-5-2[1m]. Opus 4.6 uses 1M context on Max or with Extra Usage; Sonnet 4.6 requires Extra Usage. Other supported 1M models use the bridge's compatibility table. Unknown models default to 200K; use forceTwoHundredK if the requested larger window is unavailable on your account.

Compatibility and limitations

  • Felan tools, tool approvals, and ask_user remain in Felan. Claude Code's native tools are disabled; Felan tools are exposed through the in-process MCP server.
  • Project context, skills, custom and appended instructions, and structured systemPromptOptions.sections are forwarded. Extensions should use these structured sections rather than replace the complete system prompt.
  • Felan's harness prompt is not forwarded. The bridge rejects prompts containing known Pi harness text rather than silently sending them. Anthropic determines whether a request is eligible for plan quota or Extra Usage.
  • Compaction, branch summaries, and titles use isolated Claude Code queries. Prompt-only, tool-free calls with a single user message and no captured session prompt also use isolated queries, including Fusion through Felan's Models service. Subagents receive their own Claude Code conversations. The deprecated upstream AskClaude tool is not included; use Felan subagents.
  • Each Felan session keeps its Claude Code process between prompts and writes the next prompt to it. A new thinking level is applied to the running process first. A change of model, tools, working directory, projected instructions, or bridge settings, switching thinking off or back on, or a history rewrite, starts a new process that resumes the conversation. The process stops when the session shuts down (including daemon idle eviction) or switches to another model; an idle process uses roughly 200–260 MB of memory.
  • Compaction, tree navigation, aborts, and model switches can require rewriting the mirrored history. A rebuild resends history and can miss the prompt cache.
  • Mid-session prompt changes may not reach Claude Code until a rebuild. Start a new session when updated instructions must take effect immediately.
  • Claude Code settings and hooks can affect its subprocess. Review machine-local hooks if they duplicate Felan instructions. Enabling inherited Anthropic environment variables can redirect requests or change authentication/billing.
  • Every Felan session using claude-code creates a Claude Code session JSONL copy under ~/.claude/projects/<cwd>/ (or $CLAUDE_CONFIG_DIR/projects/<cwd>/). These copies remain after Felan sessions close or are deleted and appear in Claude Code's own /resume list. The SDK spawns a local process; this host-only bridge is not a sandbox and requires access to those files for history mirroring.

Debugging

Set CLAUDE_BRIDGE_DEBUG=1 before starting Felan to enable bridge debug output and per-query Claude Code CLI logs:

  • claude-bridge.log under the extension's activation agentDir records calls, history synchronization, tool results, and subprocess stderr.
  • CLAUDE_BRIDGE_DEBUG_PATH overrides the bridge log path. CLI logs go into cc-cli-logs/ beside that path.
  • claude-bridge-diag.log under agentDir records exceptional invariant failures.

For session-resume errors, inspect the syncResult: lines and matching CLI log. Logs can contain prompts, tool output, and other sensitive data; redact them before sharing. For authentication errors, run claude and /login on the host.

Development

pnpm --filter @felan-ai/ext-claude-code build
pnpm --filter @felan-ai/ext-claude-code type-check
pnpm --filter @felan-ai/ext-claude-code test

Tests use fake SDK entries and isolated storage; they do not require a Claude login, download the SDK, or spawn Claude Code.

Attribution

Adapted from MIT-licensed pi-claude-bridge 0.9.3 by Eli Dickinson, commit 874fa7c2678456336f23b64e784e2057e608d83e, originally based on claude-agent-sdk-pi by Prateek Sunal. See NOTICE and LICENSE. Anthropic's Agent SDK and Claude Code are separately licensed and installed only on explicit request.

版本与发布记录

@felan-ai/ext-claude-code 共发布 9 个版本,首次发布于 2026/10/21;过去 12 个月发布了 9 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.1latest2026/11/122 天前
0.4.02026/11/104 天前
0.3.02026/11/059 天前
0.2.12026/10/2322 天前
0.2.02026/10/2223 天前
0.1.12026/10/2223 天前

其他发布通道:bootstrap → 0.0.0。

关于 @felan-ai/ext-claude-code 的常见问题

@felan-ai/ext-claude-code 是什么?

Claude Code plan-backed model provider for Felan

如何安装 @felan-ai/ext-claude-code?

在项目目录运行 npm install @felan-ai/ext-claude-code,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@felan-ai/agent-core(^0.15.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@felan-ai/ext-claude-code 支持 TypeScript 吗?

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

@felan-ai/ext-claude-code 支持 ESM 还是 CommonJS?

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

@felan-ai/ext-claude-code 需要什么版本的 Node.js?

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

@felan-ai/ext-claude-code 可以商用吗?

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

@felan-ai/ext-claude-code 的下载量有多少?

根据 npm 官方下载统计,@felan-ai/ext-claude-code 在 2026/10/15 – 2026/11/13 这 30 天内被下载 2,335 次,日均约 78 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@felan-ai/ext-claude-code 还在维护吗?

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