@felan-ai/ext-codex

中文文档
0.12.0发布于 2026/11/05MITTypeScriptES Module构建来源已验证近 30 天下载 2290

Codex-compatible structured tools and OpenAI request controls for Felan

原始使用文档
文档目录6 节
  1. Entry points
  2. Codex image generation
  3. Development
  4. Package boundary and requirements
  5. Related documentation
  6. Attribution

@felan-ai/ext-codex

First-party Felan support for GPT coding tools and Codex image generation. The structured tools activate only when the selected model ID is GPT-family and the provider is exactly openai or openai-codex.

Active mode keeps ordinary read, bash, and all unrelated tools, replacing only edit and write with apply_patch. Switching to another model restores the ordinary editing tools. File operations use the current AgentRuntime. The local TUI presents patch calls with friendly action labels while headless modes continue to expose the stable tool name and raw results.

Entry points

  • @felan-ai/ext-codex is the renderer-free default extension for daemon and headless loading. Its createCodexTools export returns execution-only tools.
  • @felan-ai/ext-codex/runtime remains a renderer-free entry for direct access to createCodexExtension, createCodexExecutionTools, and request controls.

All default entries carry the same execution contribution. Agent Core resolves it from validated extension configuration and applies the configured stream wrapper; hosts do not need a Codex-specific wrapper or package-name branch. Rich patch-call rendering belongs to apps/felan; the package exports no TUI entry. The root and /runtime export the same portable API, including createCodexTools. Configured hosts should import the root without a package-specific path rewrite.

For eligible Responses requests, extensionConfig.codex.priority accepts normal, fast, or ultrafast:

{
  "extensionConfig": {
    "codex": { "priority": "ultrafast" }
  }
}

The fast boolean is deprecated and hidden from /settings; existing config files and CLI options remain supported. Explicit priority overrides it. Omit priority to retain fast: true (priority processing) or fast: false (no tier override). With neither configured, no premium tier is requested. normal explicitly requests the standard default tier, even when fast is true.

Ultrafast currently applies to the exact gpt-6-astra and gpt-6.1-sol model IDs on eligible OpenAI and Codex Responses routes. Other eligible GPT models fall back to fast (priority). Pi does not expose service-tier capability metadata, so this model rule is maintained in the extension rather than fetched from a catalog. Account, plan, workspace and endpoint eligibility still apply; rejected requests are not automatically retried at another tier.

Fast and Ultrafast consume premium usage. The commonly cited 2x/8x figures are not universal billing multipliers or guaranteed task-speed increases. Consult OpenAI's speed documentation and API pricing for your authentication method. Pi's native cost estimates do not currently include Ultrafast-specific pricing. Priority selection does not change the model's reasoning effort or transport.

postAgentRunCompaction is enabled by default. It makes eligible GPT runs defer Pi's automatic threshold compaction until the current agent run settles, which preserves the pre-0.84.4 timing while allowing the completed tool loop to finish. Set it to false to use Pi's standard timing. Manual and overflow-recovery compaction remain immediate. Pi still owns summary generation; this setting does not enable upstream OpenAI native Responses compaction.

For eligible Responses requests, the extension converts Pi's nullable function-tool strict value to false so optional arguments remain optional. Explicit true or false values, absent values, and non-function tools are left unchanged.

Pi includes GPT-6 Astra in its built-in OpenAI and OpenAI Codex catalogs. The existing GPT policy enables this extension's structured tools and native Responses controls without a custom models.json entry.

For GPT-6 Astra, Sol, Luna, and GPT-6.1 Sol using openai-responses with an OpenAI API key, Pi sends native configuration_update items itself and keeps request-level reasoning.effort fixed at medium. For openai-codex-responses on either eligible provider, this extension keeps the initial request-level effort and projects a configuration_update before the next user message. Older openai/openai-responses sessions ignore persisted codex-reasoning-update entries and resume at Pi's fixed medium request effort, so expect one prompt-cache miss if their original initial effort was not medium. The extension's updates are retained across session resume and forks; after Pi compaction, the new context establishes its own effort baseline. A queued user follow-up receives its change before its next response; a tool-only continuation does not. Changes without another user turn are recorded when the run settles. These extension updates require standard, single-agent Responses requests; pro mode, server-side multi-agent mode, Chat Completions, other GPT models, and Anthropic are not supported. Automatic server truncation and compaction cannot be combined with native updates; Pi's existing local compaction remains available. Actual cache hits also depend on provider cache eligibility and can be checked using response usage cached-token counts.

Reasoning updates do not change provider transport. forceCachedWebSockets still applies only to openai-codex / openai-codex-responses; the official OpenAI API continues to use Pi's native transport.

The extension excludes restart-durable jobs, web access, Code Mode/Responses Lite, prompt replacement, native Responses compaction, voice, and UI widgets.

Codex image generation

extensionConfig.codex.imageGeneration defaults to true. When the host supplies MODELS_SERVICE, the extension registers the image-only openai-codex-images provider with gpt-image-2 and gpt-image-2.5. @felan-ai/ext-model-tools exposes these through generate_images when the session has an authenticated openai-codex login. Run /login openai-codex to use the legacy Codex login. Signing in with ChatGPT on the openai provider does not enable these image models. The selected chat model does not need to use Codex. Sessions restricted by enabledModels list no image models, because the scope contains only chat models.

Requests use POST https://chatgpt.com/backend-api/codex/images/generations, or /images/edits on the same backend with up to five reference images. They set background to opaque, quality and size to auto, and the originator header to pi. Requests count against the ChatGPT plan's Codex usage, not OpenAI API billing. The models have no API price, so Felan reports returned token counts without USD cost accounting.

Set imageGeneration to false to disable provider registration without changing Codex chat behavior. Restart or create a session after changing it.

Development

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

See NOTICE for upstream attribution.

Package boundary and requirements

Agent Core owns the runtime contract and Pi owns chat-provider transport. This package owns provider/model eligibility, structured patch replacement, request controls, and the image-only provider. It does not replace Pi's chat providers. File operations go through the active AgentRuntime.

The package requires a compatible @felan-ai/agent-core peer and TypeBox. Neither the root nor /runtime loads terminal renderers. Host mode remains current-user access and is not a sandbox.

Attribution

Selected implementation behavior is adapted from the reviewed @howaboua/pi-codex-conversion and @howaboua/pi-codex-imagegen sources. See NOTICE and LICENSE for source commits and attribution.

版本与发布记录

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

版本发布日期距今
0.12.0latest2026/11/059 天前
0.11.12026/11/0410 天前
0.11.02026/10/2223 天前
0.10.02026/10/2025 天前
0.9.12026/10/101 个月前
0.9.02026/10/081 个月前

其他发布通道:bootstrap → 0.0.0。

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

@felan-ai/ext-codex 是什么?

Codex-compatible structured tools and OpenAI request controls for Felan

如何安装 @felan-ai/ext-codex?

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

@felan-ai/ext-codex 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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

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

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