@fieldwangai/agentflow 0.1.85 → 0.1.87

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.
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
  </p>
17
17
 
18
18
  >
19
- > Orchestrate complex, long-running tasks — module migrations, AI automation, deep code cleanup — using Cursor / OpenCode / Claude Code as swappable backends.
19
+ > Orchestrate complex, long-running tasks — module migrations, AI automation, deep code cleanup — using Cursor / OpenCode / Claude Code / Codex as swappable backends.
20
20
 
21
21
  ![AgentFlow Projects](docs/projects.png)
22
22
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  ## The Problem
28
28
 
29
- Coding agents like Cursor and Claude Code are great — until the task gets long.
29
+ Coding agents like Cursor, Claude Code, and Codex are great — until the task gets long.
30
30
 
31
31
  **1. Context window is a hard ceiling.**
32
32
  A 10-minute task fits comfortably. A 10-hour migration? The model starts forgetting earlier steps, repeating work, or silently drifting off course. Context compression helps, but it's lossy — the agent no longer has the full picture.
@@ -41,7 +41,7 @@ You can write a numbered plan in a prompt, but you can't express "loop until com
41
41
 
42
42
  ## Features
43
43
 
44
- - **Reuse your AI subscriptions** — Cursor Pro, OpenCode (Alibaba Cloud, etc.), Claude Code; no need to purchase LLM API keys
44
+ - **Reuse your AI subscriptions** — Cursor Pro, OpenCode (Alibaba Cloud, etc.), Claude Code, Codex; no need to purchase LLM API keys
45
45
  - **Visual editor + AI Composer** — drag-and-drop nodes or describe workflows in natural language
46
46
  - **Persistent state** — every node's I/O cached to disk (like Gradle task caching); resume from any failure point
47
47
  - **Loop / branch / parallel** — `control_if`, `control_anyOne`, `control_toBool` for real control flow
@@ -49,7 +49,7 @@ You can write a numbered plan in a prompt, but you can't express "loop until com
49
49
 
50
50
  ## Quick Start
51
51
 
52
- **Requirements:** Node >= 18, one of: Cursor CLI (`agent`), OpenCode CLI, or Claude Code
52
+ **Requirements:** Node >= 18, one of: Cursor CLI (`agent`), OpenCode CLI, Claude Code, or Codex CLI
53
53
 
54
54
  ```bash
55
55
  # Install
@@ -157,7 +157,7 @@ Skills are automatically loaded when relevant tasks are detected, providing doma
157
157
  |------|-------------|
158
158
  | `--workspace-root <path>` | Workspace root directory |
159
159
  | `--dry-run` | Preview ready nodes without execution |
160
- | `--model <name>` | Override model |
160
+ | `--model <name>` | Override model. Use prefixes such as `opencode:<model>`, `claude-code:<model>`, `codex:<model>`, or `api:<provider>/<model>` to switch backends |
161
161
  | `--parallel` | Parallel execution for independent nodes |
162
162
  | `--machine-readable` | JSON event stream (for UI/CI integration) |
163
163
  | `--lang <code>` | Language (`zh` / `en`) |
@@ -172,8 +172,24 @@ Skills are automatically loaded when relevant tasks are detected, providing doma
172
172
  | `CLAUDE_CODE_CMD` | `claude` | Claude Code CLI command |
173
173
  | `AGENTFLOW_CLAUDE_CODE_BYPASS_PERMISSIONS` | `1` | Pass `--dangerously-skip-permissions` to Claude Code; set `0` for interactive approval |
174
174
  | `AGENTFLOW_CLAUDE_CODE_STDERR_INHERIT` | `0` | Forward Claude Code stderr directly to terminal for debugging |
175
+ | `CODEX_CMD` | `codex` | Codex CLI command |
176
+ | `CODEX_MODEL` | — | Default Codex model when no explicit `codex:<model>` is set |
177
+ | `AGENTFLOW_CODEX_SANDBOX` | `workspace-write` | Codex sandbox mode passed to `codex exec` |
178
+ | `AGENTFLOW_CODEX_APPROVAL` | `never` | Codex approval policy passed before `exec` |
179
+ | `AGENTFLOW_CODEX_DANGER` | `0` | Set `1` to pass `--dangerously-bypass-approvals-and-sandbox` to Codex |
180
+ | `AGENTFLOW_CODEX_SKIP_GIT_CHECK` | `auto` | Skip Codex git-repo check automatically when the execution directory has no `.git` ancestor; set `1`/`0` to force |
181
+ | `AGENTFLOW_CODEX_IGNORE_USER_CONFIG` | `1` | Run Codex with `--ignore-user-config` so AgentFlow jobs only use the MCP/config overrides AgentFlow passes in; set `0` to also load the user's Codex config |
182
+ | `AGENTFLOW_CODEX_STDERR_INHERIT` | `0` | Forward Codex stderr directly to terminal for debugging |
175
183
  | `AGENTFLOW_HOME` | `~/agentflow` | User data directory |
176
184
 
185
+ ### Codex Backend
186
+
187
+ Use `--model codex:<model>` or select a Codex model in the Web UI to run Composer or agent nodes through `codex exec`. Run `codex login` first, then refresh model lists with `agentflow update-model-lists` so the UI can show Codex models.
188
+
189
+ Composer reuses the MCP servers managed in AgentFlow's MCP page by translating Cursor MCP config into Codex `-c mcp_servers...` overrides for the current process. Stdio MCP private env values are passed through the Codex child process environment; HTTP `Authorization: Bearer ...` headers are converted to `bearer_token_env_var`.
190
+
191
+ The MCP page shows a backend compatibility matrix for each server. Codex is marked partial when a server relies on features Codex cannot express exactly, such as arbitrary HTTP headers or URL-level env values.
192
+
177
193
  ## Directory Layout
178
194
 
179
195
  ```
package/README.zh-CN.md CHANGED
@@ -16,7 +16,7 @@
16
16
  </p>
17
17
 
18
18
  >
19
- > 编排复杂、长时间运行的任务——模块迁移、AI 自动化、代码深度清理——以 Cursor / OpenCode / Claude Code 为可切换后端。
19
+ > 编排复杂、长时间运行的任务——模块迁移、AI 自动化、代码深度清理——以 Cursor / OpenCode / Claude Code / Codex 为可切换后端。
20
20
 
21
21
  ![AgentFlow Projects](docs/projects.png)
22
22
 
@@ -26,7 +26,7 @@
26
26
 
27
27
  ## 解决什么问题
28
28
 
29
- Cursor、Claude Code 这些 Coding Agent 很好用——直到任务变长。
29
+ Cursor、Claude Code、Codex 这些 Coding Agent 很好用——直到任务变长。
30
30
 
31
31
  **1. 上下文窗口是硬天花板。**
32
32
  跑 10 分钟的任务没问题,跑 10 小时的大型迁移?模型开始遗忘前面的步骤、重复已做过的工作、或悄悄偏离方向。上下文压缩能续命,但它是有损的——agent 看到的已经不是完整画面。
@@ -41,7 +41,7 @@ Cursor、Claude Code 这些 Coding Agent 很好用——直到任务变长。
41
41
 
42
42
  ## 核心特性
43
43
 
44
- - **复用你的 AI 订阅** — Cursor Pro、OpenCode(阿里云等)、Claude Code;无需购买 LLM API key
44
+ - **复用你的 AI 订阅** — Cursor Pro、OpenCode(阿里云等)、Claude Code、Codex;无需购买 LLM API key
45
45
  - **可视化编辑器 + AI Composer** — 拖拽节点或用自然语言描述工作流
46
46
  - **状态持久化** — 每个节点的输入输出缓存到磁盘(类似 Gradle task cache),任意节点失败可续跑
47
47
  - **循环 / 分支 / 并行** — `control_if`、`control_anyOne`、`control_toBool` 实现真正的控制流
@@ -49,7 +49,7 @@ Cursor、Claude Code 这些 Coding Agent 很好用——直到任务变长。
49
49
 
50
50
  ## 快速开始
51
51
 
52
- **环境要求:** Node >= 18,以及 Cursor CLI (`agent`) / OpenCode CLI / Claude Code 任一
52
+ **环境要求:** Node >= 18,以及 Cursor CLI (`agent`) / OpenCode CLI / Claude Code / Codex CLI 任一
53
53
 
54
54
  ```bash
55
55
  # 安装
@@ -157,7 +157,7 @@ AgentFlow 提供专用技能用于常见操作:
157
157
  |------|------|
158
158
  | `--workspace-root <path>` | 工作区根目录 |
159
159
  | `--dry-run` | 只预览就绪节点,不执行 |
160
- | `--model <name>` | 覆盖模型 |
160
+ | `--model <name>` | 覆盖模型。可用 `opencode:<model>`、`claude-code:<model>`、`codex:<model>`、`api:<provider>/<model>` 前缀切换后端 |
161
161
  | `--parallel` | 并行执行无依赖节点 |
162
162
  | `--machine-readable` | JSON 事件流(供 UI/CI 集成) |
163
163
  | `--lang <code>` | 语言(`zh` / `en`) |
@@ -172,8 +172,24 @@ AgentFlow 提供专用技能用于常见操作:
172
172
  | `CLAUDE_CODE_CMD` | `claude` | Claude Code CLI 命令 |
173
173
  | `AGENTFLOW_CLAUDE_CODE_BYPASS_PERMISSIONS` | `1` | 向 Claude Code 传递 `--dangerously-skip-permissions`;设置 `0` 走交互式审批 |
174
174
  | `AGENTFLOW_CLAUDE_CODE_STDERR_INHERIT` | `0` | Claude Code stderr 直接转发到终端用于调试 |
175
+ | `CODEX_CMD` | `codex` | Codex CLI 命令 |
176
+ | `CODEX_MODEL` | — | 未显式设置 `codex:<model>` 时使用的 Codex 默认模型 |
177
+ | `AGENTFLOW_CODEX_SANDBOX` | `workspace-write` | 传给 `codex exec` 的 sandbox 模式 |
178
+ | `AGENTFLOW_CODEX_APPROVAL` | `never` | 传给 Codex 的审批策略,位于 `exec` 前 |
179
+ | `AGENTFLOW_CODEX_DANGER` | `0` | 设置 `1` 时向 Codex 传递 `--dangerously-bypass-approvals-and-sandbox` |
180
+ | `AGENTFLOW_CODEX_SKIP_GIT_CHECK` | `auto` | 执行目录没有 `.git` 祖先时自动跳过 Codex git 检查;可设 `1`/`0` 强制 |
181
+ | `AGENTFLOW_CODEX_IGNORE_USER_CONFIG` | `1` | 使用 `--ignore-user-config` 启动 Codex,让 AgentFlow 任务只使用 AgentFlow 显式传入的 MCP/config;设 `0` 可同时加载用户 Codex 配置 |
182
+ | `AGENTFLOW_CODEX_STDERR_INHERIT` | `0` | Codex stderr 直接转发到终端用于调试 |
175
183
  | `AGENTFLOW_HOME` | `~/agentflow` | 用户数据目录 |
176
184
 
185
+ ### Codex 后端
186
+
187
+ 使用 `--model codex:<model>`,或在 Web UI 中选择 Codex 模型,即可让 Composer 或 agent 节点通过 `codex exec` 执行。需先执行 `codex login`,再用 `agentflow update-model-lists` 刷新模型列表,UI 才能展示 Codex 模型。
188
+
189
+ Composer 会复用 AgentFlow MCP 页面管理的 MCP server:运行 Codex 时把 Cursor MCP 配置翻译成 Codex `-c mcp_servers...` 临时覆盖参数。Stdio MCP 的私密 env 会通过 Codex 子进程环境变量传入;HTTP `Authorization: Bearer ...` header 会转换为 `bearer_token_env_var`。
190
+
191
+ MCP 页面会为每个 server 展示后端兼容矩阵。若某个 server 依赖 Codex 无法等价表达的能力,例如任意 HTTP headers 或 URL 级 env,Codex 会标记为 partial 并展示原因。
192
+
177
193
  ## 目录结构
178
194
 
179
195
  ```
package/bin/agentflow.mjs CHANGED
@@ -33,7 +33,7 @@ if (langIdx >= 0 && argv[langIdx + 1]) {
33
33
 
34
34
  const updateNotifier = require("update-notifier").default;
35
35
  const pkg = require(path.join(__dirname, "..", "package.json"));
36
- const machineOutput = argv.includes("--json") || argv.includes("--machine-readable");
36
+ const machineOutput = argv.includes("--json") || argv.includes("--machine-readable") || argv[0] === "mcp";
37
37
  if (!machineOutput) {
38
38
  updateNotifier({ pkg }).notify();
39
39
  }