@ever-works/codex-plugin

中文文档
1.0.18发布于 2026/11/03AGPL-3.0TypeScriptESM + CJS构建来源已验证近 30 天下载 2641

Codex Generator Plugin - Full pipeline plugin that delegates generation to Codex

原始使用文档
文档目录18 节
  1. Plugin metadata
  2. Pipeline Steps
  3. Authentication
  4. API Key
  5. Local Codex Auth
  6. Settings
  7. Supported Models
  8. Form Schema
  9. Prompt System
  10. Binary Management
  11. Error Handling
  12. Project Structure
  13. Development
  14. Sandbox bypass
  15. Smoke Test
  16. Troubleshooting
  17. Documentation
  18. License

@ever-works/codex-plugin

Full pipeline plugin that delegates work generation to the Codex CLI. A single Codex session researches, creates, and updates work item JSON files inside a temporary workspace.

Plugin metadata

FieldValue
IDcodex
Categorypipeline
Capabilitiespipeline, form-schema-provider, device-auth
AuthorEver Works Team
LicenseAGPL-3.0
Built-inyes
Auto-enableno

Pipeline Steps

The plugin runs 6 sequential steps:

#StepDescriptionOptional
1Setup CodexDownloads/caches the Codex CLI binary and resolves authenticationNo
2Prepare ContextCreates a temp workspace, seeds existing items and metadataNo
3Generate ItemsExecutes Codex CLI to research and generate items as JSON filesNo
4Collect ResultsReads generated JSON files back into the pipeline resultNo
5Capture ScreenshotsTakes screenshots for generated items (via screenshot provider)Yes
6CleanupRemoves the temporary workspaceYes

During step 3, a taxonomy watcher monitors the workspace for new item files and keeps _meta/ taxonomy files (categories, tags, brands) in sync in real time. Progress is reported per item as files appear.

Authentication

Codex supports two authentication modes:

API Key

Provide an OpenAI API key in plugin settings (apiKey field).

Get one from platform.openai.com/account/api-keys.

Local Codex Auth

If no API key is configured, the plugin can use local Codex CLI auth stored in a managed per-user CODEX_HOME. Authenticate via the onboarding wizard or manually:

codex login

The plugin materializes an isolated CODEX_HOME for each Ever Works user under its managed temp work, so local Codex auth does not rely on a shared ~/.codex/auth.json.

The onboarding UI provides a 3-step flow: choose auth mode, configure credentials, and verify the connection.

Settings

SettingTypeScopeDescription
authModestringuserapi-key or local (hidden, set by onboarding wizard)
apiKeystringuserOpenAI API key (secret, supports env var OPENAI_API_KEY)
modelstringglobalModel for generation (default: gpt-5.4)
unsafeBypassSandboxbooleanhiddenBypass Codex sandboxing on incompatible hosts

Supported Models

  • GPT-5.4 (default) - 400k context
  • Codex Mini Latest - 200k context
  • GPT-5.2 Codex - 400k context

Form Schema

The plugin provides a user-facing form with two configurable fields:

FieldTypeDefaultValidationDescription
target_itemsnumber501-500Target number of new items to generate
capture_screenshotsbooleanfalse-Take screenshots for generated items

Prompt System

Prompts are managed through a prompt facade (e.g., Langfuse). When no external prompt is found, hardcoded defaults are used as fallback.

Prompt keys:

  • codex.system - System prompt template
  • codex.user - User prompt template

Both support variable substitution for work context, existing items, categories, tags, and brands.

Binary Management

The plugin automatically downloads and caches the Codex CLI binary:

  • Binaries are cached in /tmp/codex-generator/bin/
  • Supports Linux (x64/arm64) and macOS (x64/arm64)
  • Falls back to a system-installed codex command if download fails
  • Default CLI version: 0.120.0

Error Handling

  • Non-zero exit codes: Treated as soft warnings. If items were still produced, the result succeeds with warnings attached.
  • Sandbox write blocks: Detected and logged, but never retried with sandbox bypass on their own. The detector reads Codex's stdout/stderr, which is model-produced text that injected content (a fetched page, a README) can steer, so it cannot be allowed to escalate a run to --dangerously-bypass-approvals-and-sandbox. Bypass happens only when the operator explicitly enables unsafeBypassSandbox (then every run starts bypassed). See Sandbox bypass.
  • Structured output recovery: If Codex completes without writing item files, the plugin attempts a second pass using --output-schema and --output-last-message to recover structured output.
  • Masked secrets: The getRealSecret helper filters out UI placeholder values (••••) before using credentials.

Project Structure

src/
  codex.plugin.ts          # Main plugin class (IPlugin, IPipelinePlugin, IFormSchemaProvider, ILocalAuthProvider)
  types.ts                 # Step IDs, constants
  steps.ts                 # Pipeline step definitions
  form-schema.ts           # Form fields, groups, validation
  prompt-keys.ts           # Prompt facade keys
  device-auth.ts            # Device auth flow (codex login --device-auth)
  index.ts                 # Public exports
  prompt/
    system-prompt.ts       # Default prompts and variable builders
  utils/
    binary-manager.ts      # CLI binary download and caching
    pipeline-helpers.ts    # State management, auth resolution, progress reporting
    process-runner.ts      # Codex CLI subprocess execution
    workspace-manager.ts   # Workspace I/O (create, seed, read, cleanup)
    screenshot-capture.ts  # Screenshot facade integration
    taxonomy-sync.ts       # Merge new categories/tags/brands into _meta files
    taxonomy-watcher.ts    # Filesystem watcher for live taxonomy sync
    platform.ts            # Platform detection helpers
    subprocess-env.ts      # Environment variable setup for subprocesses
scripts/
  smoke-codex.mjs          # Manual smoke test script

Development

# Build
pnpm build

# Type-check
pnpm type-check

# Run tests
pnpm test

# Watch mode
pnpm test:watch

# Coverage
pnpm test:coverage

Sandbox bypass

Codex runs inside its own sandbox unless told otherwise. Two paths can run it with --dangerously-bypass-approvals-and-sandbox (full host access, no approvals):

  • Generation pipeline — only when the operator sets unsafeBypassSandbox: true (hidden setting, default false). The plugin no longer escalates on its own when Codex's output says writes were blocked: that output is model text, and a prompt-injected model could print exactly those phrases. A declined escalation is logged as a warning; structured-output recovery still runs, sandboxed.
  • Code-edit path (executeCodeEdit) — always passes the bypass flag today. It edits a workspace the platform provisioned for the run and needs unrestricted writes there. Treat any host running code-edit as giving the Codex process the plugin's own OS privileges: run it in a container/VM with no credentials or networks it should not reach. This behaviour is unchanged and documented here so it is a known, reviewed trade-off.

Smoke Test

Validate real Codex CLI integration locally:

pnpm smoke

For hosts requiring sandbox bypass:

CODEX_SMOKE_BYPASS_SANDBOX=1 pnpm smoke

Requires either OPENAI_API_KEY in the environment or local Codex auth (codex login).

Troubleshooting

SymptomLikely causeFix
Generation never starts / stays at 0%codex not selected as the active pipeline plugin for this workOpen the work → Plugins → pipeline capability and set codex as the active pipeline; or set it as the global pipeline default in Settings → Plugins
Step fails with No AI / search / screenshot provider configuredPipeline depends on capability plugins that are not enabled or have no credentialsEnable and configure the matching capability plugin (AI provider, search, screenshot, content-extractor) for the work or globally
Step output looks wrong / genericForm-field tuning not set; pipeline using defaults that don't match the work's domainOpen the Generator Form for the work, set domain-specific fields (categories, target keywords, source URLs), and re-run the affected step
Subprocess error: command not foundCodex Generator CLI not installed on the host running the APIInstall the Codex Generator CLI on the API host and ensure it is on PATH; verify by running which <cli> from the same shell that launches pnpm dev:api
Authentication / device-auth flow stallsDevice-auth code never confirmed in the upstream IDE / browserRe-run the device-auth flow from Settings → Plugins → codex → Connect, then complete the prompt in the upstream service before the code expires
Pipeline cannot resume after host restartCheckpoint not persisted (only the standard pipeline persists checkpoints today)Cancel the stuck run and re-trigger generation; for production reliability prefer standard-pipeline

Documentation

License

AGPL-3.0

版本与发布记录

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

版本发布日期距今
1.0.18latest2026/11/0310 天前
1.0.172026/10/2817 天前
1.0.162026/10/2717 天前
1.0.152026/10/2717 天前
1.0.142026/10/2420 天前
1.0.132026/10/2025 天前

关于 @ever-works/codex-plugin 的常见问题

@ever-works/codex-plugin 是什么?

Codex Generator Plugin - Full pipeline plugin that delegates generation to Codex

如何安装 @ever-works/codex-plugin?

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

@ever-works/codex-plugin 支持 TypeScript 吗?

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

@ever-works/codex-plugin 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ever-works/codex-plugin 可以商用吗?

@ever-works/codex-plugin 使用 AGPL-3.0 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@ever-works/codex-plugin 的下载量有多少?

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

@ever-works/codex-plugin 还在维护吗?

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