codex-task 0.2.1 → 0.2.3

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codex-task",
3
- "version": "0.2.1",
4
- "description": "Delegate focused text, image, and workspace tasks to CodexTask",
3
+ "version": "0.2.3",
4
+ "description": "Delegate multimodal text, image, and workspace tasks to CodexTask",
5
5
  "author": {
6
6
  "name": "wang121ye",
7
7
  "url": "https://github.com/wangyendt"
@@ -18,8 +18,8 @@
18
18
  "skills": "./skills/",
19
19
  "interface": {
20
20
  "displayName": "CodexTask",
21
- "shortDescription": "Delegate text, image, and workspace tasks",
22
- "longDescription": "A companion skill for routing focused text, image, and workspace tasks through the CodexTask CLI.",
21
+ "shortDescription": "Delegate multimodal text, image, and workspace tasks",
22
+ "longDescription": "A companion skill for routing composable text, image, and workspace inputs through the CodexTask CLI.",
23
23
  "developerName": "wang121ye",
24
24
  "category": "Developer Tools",
25
25
  "capabilities": [
package/README.md CHANGED
@@ -1,273 +1,253 @@
1
1
  # CodexTask
2
2
 
3
- > Give another AI agent a focused errand—and get back text, images, or finished work. Powered by your existing Codex setup.
3
+ > 把文本、图片和项目任务交给另一个 Codex worker,拿回结构化文本、生成图片或已经完成的工作区变更。
4
4
 
5
- [中文文档](./README.zh-CN.md) · [PRD](./docs/PRD.md) · [Companion skill](./skills/codex-task/SKILL.md)
5
+ [English](./README_EN.md) · [产品需求文档](./docs/PRD.md) · [常用命令](./docs/常用命令.txt) · [Companion Skill](./skills/codex-task/SKILL.md)
6
6
 
7
- CodexTask turns Codex into a small, composable worker for other agents. It ships one CLI, one TypeScript API, and one installable skill for three jobs:
7
+ CodexTask 是一个轻量、可组合的跨 Agent 多模态任务运行器。它提供一个 CLI、一个 TypeScript API 和一个可安装给其他 Agent Skill;没有 daemon,没有托管服务,也不需要额外 API key。
8
8
 
9
- - focused text-to-text tasks;
10
- - text-to-image and image-to-image generation;
11
- - bounded workspace tasks through the official Codex SDK.
9
+ 你只需要按“想拿回什么”选择命令:
12
10
 
13
- No daemon. No hosted service. No extra API key. Results are stable JSON that another agent can consume.
11
+ | 期望结果 | 命令 | 可组合输入 | 典型任务 |
12
+ | --- | --- | --- | --- |
13
+ | 文本 | `codex-task text` | 文本、多个 prompt 文件、最多 5 张图片、stdin | 文生文、图生文、图文生文 |
14
+ | 图片 | `codex-task image` | 文本、多个 prompt 文件、最多 5 张参考图、stdin | 文生图、图生图、图文生图 |
15
+ | 工作区变更 | `codex-task task` | 文本、多个 prompt 文件、最多 5 张图片、当前项目 | 写代码、改文件、运行命令 |
16
+ | 恢复任务 | `codex-task resume` | task ID、补充文本/文件/图片 | 回答追问后继续同一个 Codex task |
14
17
 
15
18
  > [!IMPORTANT]
16
- > CodexTask is an independent, unofficial open-source project. It is not affiliated with, endorsed by, or sponsored by OpenAI. Codex and OpenAI are trademarks of OpenAI.
19
+ > CodexTask 是独立的非官方开源项目,与 OpenAI 不存在隶属、认可或赞助关系。Codex OpenAI OpenAI 的商标。
17
20
 
18
- ## Quick start
21
+ ## 30 秒上手
19
22
 
20
- Requirements: Node.js 20+ and an existing Codex login (`codex login`).
23
+ 需要 Node.js 20+,并已执行过 `codex login`。
21
24
 
22
25
  ```bash
23
26
  npm install -g codex-task
24
27
  codex-task doctor
25
28
  ```
26
29
 
27
- Delegate a text result:
30
+ 下面用一次“健身营养餐”任务串起四种输出。
28
31
 
29
- ```bash
30
- codex-task text "Turn these notes into a crisp release announcement" \
31
- --backend direct
32
- ```
33
-
34
- Generate an image that will not be removed by temporary-file cleanup:
32
+ ### 1. 生成图片:一份健身营养餐
35
33
 
36
34
  ```bash
37
- codex-task image "A precise exploded-view diagram of a compact robot joint" \
38
- --backend direct \
39
- --size 1536x1024 \
40
- --quality high \
41
- --output ./artifacts
35
+ codex-task image "生成一份写实、干净的健身营养餐:香煎鸡胸肉、糙米、西兰花、牛油果,俯拍,食材边界清晰"
42
36
  ```
43
37
 
44
- Edit an image:
38
+ 不传 `--output` 时,最终图片默认保存在当前目录,而不是临时目录:
45
39
 
46
- ```bash
47
- codex-task image "Keep the object; replace the background with a clean workshop" \
48
- --backend direct \
49
- --image ./reference.png \
50
- --output ./artifacts
40
+ ```json
41
+ {
42
+ "status": "completed",
43
+ "taskId": "a1b2c3d4-...",
44
+ "backend": "direct",
45
+ "text": "Generated 1 image(s).",
46
+ "effectiveModel": "gpt-5.5",
47
+ "artifacts": [
48
+ { "path": "/your/project/image-a1b2c3d4.png", "kind": "image", "mimeType": "image/png" }
49
+ ]
50
+ }
51
51
  ```
52
52
 
53
- Delegate repository work:
53
+ ### 2. 图片 + prompt → JSON 营养分析
54
54
 
55
55
  ```bash
56
- codex-task task "Implement the requested feature and run focused tests" \
57
- --backend sdk \
58
- --cwd /absolute/path/to/repo
56
+ codex-task text "识别图中的食物,估算每项热量和总热量,只返回 JSON" -i ./image-a1b2c3d4.png
59
57
  ```
60
58
 
61
- Every command writes a machine-readable result:
59
+ `text` 不只是文生文,也支持图生文和图文生文:
62
60
 
63
61
  ```json
64
62
  {
65
63
  "status": "completed",
66
- "taskId": "e6fe7ed7-72de-4b27-8b6e-08152192d6cb",
64
+ "taskId": "b2c3d4e5-...",
67
65
  "backend": "direct",
68
- "text": "...",
69
- "effectiveModel": "gpt-5.6-sol",
70
- "reasoningEffort": "medium",
66
+ "text": "{\"foods\":[{\"name\":\"鸡胸肉\",\"calories\":248},{\"name\":\"糙米\",\"calories\":216},{\"name\":\"西兰花\",\"calories\":55},{\"name\":\"牛油果\",\"calories\":160}],\"totalCalories\":679}",
71
67
  "artifacts": []
72
68
  }
73
69
  ```
74
70
 
75
- ## Pick the backend
71
+ 需要严格 JSON Schema 时可传 `--schema ./nutrition.schema.json`。
76
72
 
77
- CodexTask never guesses. Direct is the CLI default, but workspace tasks require an explicit SDK backend.
73
+ ### 3. 多份要求 + 参考图 完成项目
78
74
 
79
- | Capability | `direct` | `sdk` |
80
- | --- | --- | --- |
81
- | Focused text result | Yes | Yes |
82
- | Text-to-image / image-to-image | Yes, native result extraction | Yes, via the installed `$imagegen` skill |
83
- | Shell and file edits | No | Yes |
84
- | Project rules and local tools | No | Yes |
85
- | Local Codex skills | No | Normal Codex discovery |
86
- | Transport | Unofficial ChatGPT Codex Responses | Official `@openai/codex-sdk` |
87
- | Stability | Experimental | Supported SDK surface |
88
-
89
- Direct reuses `$CODEX_HOME/auth.json`, Codex installation metadata, TLS impersonation, and the private ChatGPT Codex Responses endpoint. Inputs are still sent to ChatGPT. The interface may change without notice.
75
+ ```bash
76
+ codex-task task "实现一个健身营养餐详情页,并运行相关测试" -f ./requirements.md -f ./api-contract.md -i ./image-a1b2c3d4.png --cwd ./meal-app
77
+ ```
90
78
 
91
- The SDK backend defaults to:
79
+ `task` 固定使用官方 Codex SDK,不需要再写 `--backend sdk`。`--cwd ./meal-app` 表示:把该目录作为 worker 的当前项目;Codex 会从这里读取代码、项目规则与 skills,并在授权范围内修改文件、执行命令。
92
80
 
93
- ```text
94
- sandbox: danger-full-access
95
- approval: never
96
- network: true
81
+ ```json
82
+ {
83
+ "status": "completed",
84
+ "taskId": "7dd7a7d7-...",
85
+ "backend": "sdk",
86
+ "threadId": "019...",
87
+ "text": "已实现营养餐详情页并通过相关测试。",
88
+ "changes": ["src/pages/MealDetail.tsx", "test/MealDetail.test.tsx"],
89
+ "commands": [{ "command": "npm test -- MealDetail", "exitCode": 0 }],
90
+ "artifacts": []
91
+ }
97
92
  ```
98
93
 
99
- That combination is intentionally powerful: it can read and write outside the workspace, execute commands, and use the network without asking for approval. Only delegate trusted prompts and repositories.
94
+ ### 4. 回答追问并继续
100
95
 
101
- ## Agent follow-ups
102
-
103
- SDK tasks are single-turn first. If the worker needs clarification, the result is not an error:
96
+ 如果任务存在关键歧义,`task` 可能返回:
104
97
 
105
98
  ```json
106
99
  {
107
100
  "status": "needs_input",
108
- "taskId": "...",
109
- "threadId": "...",
110
- "questions": ["Should the API preserve the legacy response shape?"],
101
+ "taskId": "7dd7a7d7-...",
102
+ "questions": ["页面按单人份还是双人份展示热量?"],
111
103
  "artifacts": []
112
104
  }
113
105
  ```
114
106
 
115
- Ask the user, then resume the same Codex thread:
107
+ 取得答案后,用同一个 task ID 恢复;补充回答也可以同时带多个文件和图片:
116
108
 
117
109
  ```bash
118
- printf '%s' "Yes, preserve it." | codex-task resume <task-id>
110
+ codex-task resume 7dd7a7d7-... "按单人份展示" -f ./copy-guidelines.md -i ./expected-layout.png
119
111
  ```
120
112
 
121
- Pass `--no-followup` to require reasonable assumptions and a completed/failed result in one caller turn. It does not guarantee the model succeeds.
122
-
123
- ## Use from another agent
113
+ ```json
114
+ {
115
+ "status": "completed",
116
+ "taskId": "7dd7a7d7-...",
117
+ "backend": "sdk",
118
+ "text": "已按单人份完成页面和测试。",
119
+ "changes": ["src/pages/MealDetail.tsx"],
120
+ "artifacts": []
121
+ }
122
+ ```
124
123
 
125
- This repository ships `skills/codex-task/SKILL.md`. It teaches a calling agent when to choose text, image, task, or resume. It is a companion skill, not a skill injected into the Codex worker.
124
+ ## 组合输入,而不是四选一
126
125
 
127
- Install it with [skillmanager](https://github.com/wangyendt/skillmanager):
126
+ 位置 prompt、重复的 `-f/--prompt-file`、非空 stdin 和重复的 `-i/--image` 可以同时出现:
128
127
 
129
128
  ```bash
130
- npm install -g @wang121ye/skillmanager
131
- skillmanager install https://github.com/wangyendt/codex-task --global
129
+ printf '%s' "总热量控制在 700 kcal 内" | codex-task text "制定调整建议" -f ./training-goal.md -f ./allergies.md -i ./meal-front.png -i ./meal-side.png
132
130
  ```
133
131
 
134
- Or locate the copy included in the npm package:
132
+ CodexTask 按固定顺序组合输入:位置 prompt prompt 文件(按命令行顺序)→ stdin;图片保持 `-i` 的顺序。文件内容会带绝对路径边界标记,避免多份长 prompt 混在一起。每张图片不超过 20 MiB,总和不超过 50 MiB。
135
133
 
136
- ```bash
137
- codex-task skill path
138
- ```
134
+ ## 两种后端
139
135
 
140
- The repository also includes `.codex-plugin/plugin.json` for plugin-compatible distribution.
141
-
142
- ## TypeScript API
136
+ `text` `image` 默认使用 Direct,可手动传 `--backend sdk`。`task` `resume` 固定使用 SDK,不做自动猜测。
143
137
 
144
- ```ts
145
- import { generateImage, generateText, runTask } from "codex-task";
138
+ | 能力 | `direct` | `sdk` |
139
+ | --- | --- | --- |
140
+ | 文本结果 | 支持文本与图片输入 | 支持文本与图片输入 |
141
+ | 图片结果 | 原生提取生成图片 | 让 Codex 调用已安装的 `$imagegen` skill |
142
+ | shell、文件修改、项目规则 | 不支持 | 支持 |
143
+ | 本地 Codex skills | 不支持 | 按 Codex 正常发现 |
144
+ | 底层 | 非官方 ChatGPT Codex Responses | 官方 `@openai/codex-sdk` |
146
145
 
147
- const copy = await generateText({
148
- prompt: "Write a launch headline and three supporting bullets.",
149
- backend: "direct",
150
- });
146
+ Direct 复用 `$CODEX_HOME/auth.json`、Codex installation metadata、TLS impersonation 和 ChatGPT 私有 Codex Responses 接口。输入仍会发往 ChatGPT,接口可能随时变化。Direct 只返回生成结果,不能读项目、运行 shell、调用本地 MCP 或使用 worker skills。
151
147
 
152
- const image = await generateImage({
153
- prompt: "A restrained isometric illustration of agent-to-agent delegation.",
154
- backend: "direct",
155
- output: "./artifacts",
156
- quality: "high",
157
- });
148
+ SDK task 默认权限为:
158
149
 
159
- const work = await runTask({
160
- prompt: "Add the feature and run focused tests.",
161
- backend: "sdk",
162
- workingDirectory: "/absolute/path/to/repo",
163
- });
150
+ ```text
151
+ sandbox: danger-full-access
152
+ approval: never
153
+ network: true
164
154
  ```
165
155
 
166
- For progress events:
167
-
168
- ```ts
169
- import { streamTaskEvents } from "codex-task";
170
-
171
- for await (const event of streamTaskEvents({
172
- kind: "text",
173
- options: { prompt: "Summarize this decision", backend: "direct" },
174
- })) {
175
- console.log(event);
176
- }
177
- ```
156
+ 这意味着 worker 可以访问工作区外路径、执行命令并联网,而且不会等待权限确认。只委派可信 prompt 和可信项目;需要收窄时显式传 `--sandbox workspace-write` 或 `--no-network`。
178
157
 
179
- The event stream reports item and task progress; it is not guaranteed token streaming.
158
+ ## 图片输出与临时文件
180
159
 
181
- ## Image controls
160
+ - 默认:在当前目录生成唯一文件名,例如 `./image-a1b2c3d4.png`;这是持久用户文件,`gc` 不会删除。
161
+ - 指定位置:传 `-o ./artifacts` 或 `-o ./meal.png`。
162
+ - 临时产物:显式传 `--temp`,写入 `os.tmpdir()/codex-task/<task-id>`,24 小时后可被清理。
163
+ - `--temp` 与 `--output` 互斥;已有目标默认拒绝覆盖,只有 `--overwrite` 才允许替换。
182
164
 
183
- ```text
184
- references 0–5 local PNG/JPEG/WebP/GIF files
185
- size auto or WIDTHxHEIGHT; longest edge ≤ 3840
186
- quality auto | low | medium | high
187
- background auto | opaque | transparent
188
- count 1–10
189
- concurrency 1–3, default 1
165
+ ```bash
166
+ codex-task image "生成三个便当配色方案" -n 3 -o ./artifacts
167
+ codex-task image "仅供本轮分析的草图" --temp
168
+ codex-task gc
190
169
  ```
191
170
 
192
- Each reference may be at most 20 MiB, with a 50 MiB combined limit. Existing outputs are rejected unless `--overwrite` is supplied. Completed images are atomically saved immediately, so a later batch failure does not discard earlier artifacts.
171
+ 图片参数:`size=auto|WIDTHxHEIGHT`(最长边 3840)、`quality=auto|low|medium|high`、`background=auto|opaque|transparent`、`count=1–10`、`concurrency=1–3`。
172
+
173
+ ## 安装给其他 Agent
193
174
 
194
- ## Inputs and output
175
+ 仓库内置 [`skills/codex-task/SKILL.md`](./skills/codex-task/SKILL.md)。它教调用方 Agent 何时运行 `text`、`image`、`task` 或 `resume`;它不是注入底层 Codex worker 的 skill。
195
176
 
196
- Long prompts can come from a file or stdin:
177
+ Skill CLI 是两件事:SkillTruck 负责安装 Skill,npm 负责安装可执行命令。安装 Skill 不会自动全局安装 npm 包。
197
178
 
198
179
  ```bash
199
- codex-task text --prompt-file task.md --backend direct
200
- printf '%s' "$PROMPT" | codex-task task --backend sdk --cwd .
180
+ npm install -g skilltruck codex-task
181
+ skilltruck install https://github.com/wangyendt/codex-task --global
201
182
  ```
202
183
 
203
- The positional prompt, `--prompt-file`, and stdin are mutually exclusive.
184
+ 如果不想全局安装 CLI,Agent 可回退到 `npx --yes codex-task@latest`。也可以运行 `codex-task skill path` 查看 npm 包内 Skill 的位置。
204
185
 
205
- Default stdout is one JSON result. `--stream` switches stdout to JSONL events. Diagnostics go to stderr. Exit codes are:
186
+ ## TypeScript API
206
187
 
207
- | Code | Meaning |
208
- | --- | --- |
209
- | `0` | `completed` or `needs_input` |
210
- | `1` | execution failure |
211
- | `2` | invalid arguments or configuration |
212
- | `130` | cancellation or timeout |
188
+ ```ts
189
+ import { generateImage, generateText, runTask } from "codex-task";
190
+
191
+ const meal = await generateImage({
192
+ prompt: "生成一份高蛋白健身营养餐",
193
+ output: ".",
194
+ });
213
195
 
214
- ## Models and configuration
196
+ const analysis = await generateText({
197
+ prompt: "识别食物并估算热量,只返回 JSON",
198
+ promptFiles: ["./nutrition-rules.md", "./allergies.md"],
199
+ imagePaths: [meal.artifacts[0]!.path],
200
+ });
215
201
 
216
- The SDK backend leaves model and reasoning unset unless you override them, allowing normal Codex configuration discovery.
202
+ const work = await runTask({
203
+ prompt: "根据要求实现营养餐详情页并测试",
204
+ promptFiles: ["./requirements.md", "./api-contract.md"],
205
+ imagePaths: [meal.artifacts[0]!.path],
206
+ workingDirectory: "./meal-app",
207
+ });
208
+ ```
217
209
 
218
- Direct resolves its model in this order:
210
+ `streamTaskEvents()` 可输出 JSONL 级别的 item/task 进度,但不保证逐 token 流式输出。
219
211
 
220
- 1. `--model` / API option;
221
- 2. Codex `config.toml`;
222
- 3. the preferred visible model in `models_cache.json`;
223
- 4. compatibility fallback.
212
+ ## 输出、状态与退出码
224
213
 
225
- It supports classic Responses and Responses Lite encoders. With a current Codex model catalog, text defaults to `gpt-5.6-sol` with `medium` reasoning. The private Responses Lite route rejects hosted `image_generation`, so Direct image requests are preflighted to the compatible classic `gpt-5.5` model before any request is sent. The final JSON always reports `effectiveModel` and `reasoningEffort`.
214
+ stdout 默认只有一个 JSON 结果;`--stream` 时为 JSONL。诊断写 stderr。
226
215
 
227
- Configuration precedence is API/CLI → `CODEX_TASK_*` environment variables → user config → Codex config → fallback. The user config is `config.json` under the standard platform config directory; run `codex-task doctor` to see the exact path.
216
+ | 状态/退出码 | 含义 |
217
+ | --- | --- |
218
+ | `completed` / `0` | 完成 |
219
+ | `needs_input` / `0` | 等待调用方补充输入,可 `resume` |
220
+ | `failed` / `1` | 执行失败 |
221
+ | 参数错误 / `2` | 输入或配置无效 |
222
+ | `cancelled` / `130` | 取消或超时 |
228
223
 
229
- For migration, `CODEXERRAND_*` variables and the former CodexErrand config/task paths are recognized only when their `CODEX_TASK_*` or CodexTask equivalents are absent. New state is always written under CodexTask paths.
224
+ `--no-followup` 会要求 SDK worker 采用合理假设并在当前 caller turn 内完成或失败,但不能保证模型一定成功。
230
225
 
231
- Useful variables include:
226
+ ## 模型与配置
232
227
 
233
- ```text
234
- CODEX_TASK_MODEL
235
- CODEX_TASK_REASONING
236
- CODEX_TASK_PROXY
237
- CODEX_TASK_CODEX_HOME
238
- CODEX_TASK_TEXT_TIMEOUT_MS
239
- CODEX_TASK_IMAGE_TIMEOUT_MS
240
- CODEX_TASK_SDK_TIMEOUT_MS
241
- CODEX_TASK_RETRIES
242
- ```
228
+ SDK 默认不覆写 model/reasoning,继续读取正常的 Codex 用户与项目配置。
243
229
 
244
- ## Temporary data
230
+ Direct 按显式参数 → Codex `config.toml` → `models_cache.json` 首选模型 → 兼容 fallback 的顺序选择模型。当前文本可使用 `gpt-5.6-sol + medium/high`;私有 Responses Lite 路由不暴露托管 `image_generation`,所以 Direct 图片会在请求前选择兼容的 classic `gpt-5.5`。这不代表 `gpt-5.6-sol` 没有视觉能力,只是这条非官方 Direct 生图协议不兼容。最终 JSON 始终返回真实的 `effectiveModel` 和 `reasoningEffort`。
245
231
 
246
- - Images without `--output` live under the platform temporary directory and expire after 24 hours.
247
- - Pending `needs_input` metadata lives under the platform state directory and expires after 7 days.
248
- - Managed temporary artifacts are capped at 1 GiB.
249
- - Explicit output paths are user data and are never removed by `codex-task gc`.
250
- - Official SDK sessions remain managed by Codex under `$CODEX_HOME`; CodexTask does not delete them.
232
+ 运行 `codex-task doctor` 可查看本机 Direct transport、OAuth、模型解析、Codex CLI/SDK 与真实数据路径,不会发送模型请求。
251
233
 
252
- ## Development and releases
234
+ ## 开发与发布
253
235
 
254
236
  ```bash
255
237
  npm install
256
238
  npm run verify
257
239
  ```
258
240
 
259
- `npm run verify` runs lint, type checking, unit tests, build, package inspection, and a clean install/import smoke test. Live Direct endpoint tests are opt-in and never run in CI:
241
+ `verify` 会执行 lint、workflow 检查、类型检查、单元测试、构建、npm 包内容检查和干净安装/import smoke test。真实 Direct endpoint 测试只允许手动执行:
260
242
 
261
243
  ```bash
262
244
  RUN_DIRECT_E2E=1 npm run test:e2e
263
245
  ```
264
246
 
265
- Every push to `main` triggers an automatic patch bump. A second workflow verifies the package, publishes through npm Trusted Publishing, and creates a `vX.Y.Z` tag. Repository setup is documented in [Release setup](./docs/RELEASING.md).
266
-
267
- ## Acknowledgements
247
+ 每次 push `main` 都会自动发布 patch 版本,详见[发布配置](./docs/RELEASING.md)
268
248
 
269
- The Direct backend is derived in part from the MIT-licensed [`lawrencewzen/imgen`](https://github.com/lawrencewzen/imgen). See [third-party notices](./THIRD_PARTY_NOTICES.md).
249
+ ## 致谢与许可
270
250
 
271
- ## License
251
+ Direct 后端部分技术与 MIT 代码源自 [`lawrencewzen/imgen`](https://github.com/lawrencewzen/imgen),详见[第三方声明](./THIRD_PARTY_NOTICES.md)。
272
252
 
273
253
  MIT © 2026 ye.wang
package/README_EN.md ADDED
@@ -0,0 +1,160 @@
1
+ # CodexTask
2
+
3
+ > Delegate text, images, and project work to another Codex worker; get back structured text, generated images, or completed workspace changes.
4
+
5
+ [中文](./README.md) · [Product requirements](./docs/PRD.md) · [Common commands](./docs/常用命令.txt) · [Companion skill](./skills/codex-task/SKILL.md)
6
+
7
+ CodexTask is a lightweight, composable multimodal task runner for agent-to-agent delegation. It ships one CLI, one TypeScript API, and one installable companion skill—without a daemon, hosted service, or extra API key.
8
+
9
+ Choose a command by the result you want:
10
+
11
+ | Result | Command | Composable inputs |
12
+ | --- | --- | --- |
13
+ | Text | `codex-task text` | inline text, prompt files, images, stdin |
14
+ | Images | `codex-task image` | inline text, prompt files, reference images, stdin |
15
+ | Workspace changes | `codex-task task` | text, prompt files, images, a current project |
16
+ | Continued work | `codex-task resume` | task ID plus text, files, and images |
17
+
18
+ > [!IMPORTANT]
19
+ > CodexTask is an independent, unofficial open-source project. It is not affiliated with, endorsed by, or sponsored by OpenAI. Codex and OpenAI are trademarks of OpenAI.
20
+
21
+ ## Quick start: one fitness-meal workflow
22
+
23
+ Requirements: Node.js 20+ and an existing Codex login (`codex login`).
24
+
25
+ ```bash
26
+ npm install -g codex-task
27
+ codex-task doctor
28
+ ```
29
+
30
+ Generate a fitness meal image. With no `--output`, the durable final image is written to the current directory:
31
+
32
+ ```bash
33
+ codex-task image "A clean top-down fitness meal with grilled chicken, brown rice, broccoli, and avocado"
34
+ ```
35
+
36
+ ```json
37
+ {
38
+ "status": "completed",
39
+ "taskId": "a1b2c3d4-...",
40
+ "backend": "direct",
41
+ "effectiveModel": "gpt-5.5",
42
+ "artifacts": [{ "path": "/your/project/image-a1b2c3d4.png", "kind": "image" }]
43
+ }
44
+ ```
45
+
46
+ Turn that image plus a prompt into nutrition JSON:
47
+
48
+ ```bash
49
+ codex-task text "Identify the foods, estimate each item's calories and the total, and return JSON only" -i ./image-a1b2c3d4.png
50
+ ```
51
+
52
+ ```json
53
+ {
54
+ "status": "completed",
55
+ "taskId": "b2c3d4e5-...",
56
+ "backend": "direct",
57
+ "text": "{\"foods\":[{\"name\":\"chicken breast\",\"calories\":248}],\"totalCalories\":679}",
58
+ "artifacts": []
59
+ }
60
+ ```
61
+
62
+ Delegate project work with multiple specifications and the generated image:
63
+
64
+ ```bash
65
+ codex-task task "Build the fitness-meal detail page and run focused tests" -f ./requirements.md -f ./api-contract.md -i ./image-a1b2c3d4.png --cwd ./meal-app
66
+ ```
67
+
68
+ `task` always uses the official Codex SDK; `--backend sdk` is unnecessary. `--cwd` is the worker's current project—the directory whose code, project instructions, and skills Codex reads and where it runs commands.
69
+
70
+ If the result is `needs_input`, answer and resume the same Codex task:
71
+
72
+ ```bash
73
+ codex-task resume 7dd7a7d7-... "Use a single serving" -f ./copy-guidelines.md -i ./expected-layout.png
74
+ ```
75
+
76
+ ## Composable multimodal input
77
+
78
+ The positional prompt, repeated `-f/--prompt-file`, non-empty stdin, and repeated `-i/--image` may be combined:
79
+
80
+ ```bash
81
+ printf '%s' "Keep the meal under 700 kcal" | codex-task text "Recommend adjustments" -f ./training-goal.md -f ./allergies.md -i ./meal-front.png -i ./meal-side.png
82
+ ```
83
+
84
+ Text is composed in a stable order: positional prompt, prompt files in command-line order, then stdin. Prompt files are wrapped with absolute-path boundaries. Images preserve `-i` order. Up to five PNG/JPEG/WebP/GIF images are accepted; each may be 20 MiB and the combined limit is 50 MiB.
85
+
86
+ ## Direct and SDK backends
87
+
88
+ `text` and `image` default to Direct and may explicitly select `--backend sdk`. `task` and `resume` are SDK-only. CodexTask never guesses the backend.
89
+
90
+ | Capability | `direct` | `sdk` |
91
+ | --- | --- | --- |
92
+ | Text from text/images | Yes | Yes |
93
+ | Images from text/images | Native result extraction | Through the installed `$imagegen` skill |
94
+ | Shell, file changes, project rules | No | Yes |
95
+ | Local Codex skills | No | Normal Codex discovery |
96
+ | Transport | Unofficial ChatGPT Codex Responses | Official `@openai/codex-sdk` |
97
+
98
+ Direct reuses `$CODEX_HOME/auth.json`, Codex installation metadata, TLS impersonation, and the private ChatGPT Codex Responses endpoint. Inputs are still sent to ChatGPT, and the interface may change without notice. Direct cannot read a repository, run local tools, call local MCP, or use worker skills.
99
+
100
+ SDK tasks default to `sandbox=danger-full-access`, `approval=never`, and `network=true`. This is intentionally powerful. Delegate only trusted prompts and projects; use `--sandbox workspace-write` or `--no-network` when needed.
101
+
102
+ ## Image output
103
+
104
+ - Default: a unique durable file in the current directory, such as `./image-a1b2c3d4.png`.
105
+ - Explicit destination: `-o ./artifacts` or `-o ./meal.png`.
106
+ - Managed temporary output: `--temp`, under `os.tmpdir()/codex-task/<task-id>`, eligible for cleanup after 24 hours.
107
+ - `--temp` and `--output` are mutually exclusive. Existing files are protected unless `--overwrite` is present.
108
+
109
+ Image controls: `size=auto|WIDTHxHEIGHT` (longest edge ≤ 3840), `quality=auto|low|medium|high`, `background=auto|opaque|transparent`, `count=1–10`, and `concurrency=1–3`.
110
+
111
+ ## Companion skill
112
+
113
+ [`skills/codex-task/SKILL.md`](./skills/codex-task/SKILL.md) teaches a calling agent how to use CodexTask. It is not injected into the underlying Codex worker. The skill and executable are separate: SkillTruck installs the skill; npm installs the CLI.
114
+
115
+ ```bash
116
+ npm install -g skilltruck codex-task
117
+ skilltruck install https://github.com/wangyendt/codex-task --global
118
+ ```
119
+
120
+ Agents may fall back to `npx --yes codex-task@latest`. `codex-task skill path` prints the packaged skill location.
121
+
122
+ ## TypeScript API
123
+
124
+ ```ts
125
+ import { generateImage, generateText, runTask } from "codex-task";
126
+
127
+ const meal = await generateImage({ prompt: "Generate a high-protein fitness meal", output: "." });
128
+ const analysis = await generateText({
129
+ prompt: "Identify foods and return calorie estimates as JSON",
130
+ promptFiles: ["./nutrition-rules.md", "./allergies.md"],
131
+ imagePaths: [meal.artifacts[0]!.path],
132
+ });
133
+ const work = await runTask({
134
+ prompt: "Build and test the meal detail page",
135
+ promptFiles: ["./requirements.md", "./api-contract.md"],
136
+ imagePaths: [meal.artifacts[0]!.path],
137
+ workingDirectory: "./meal-app",
138
+ });
139
+ ```
140
+
141
+ Default stdout is one JSON result; `--stream` produces JSONL item/task progress. Exit codes are 0 for `completed`/`needs_input`, 1 for execution failure, 2 for invalid input, and 130 for cancellation/timeout.
142
+
143
+ ## Models
144
+
145
+ SDK mode inherits normal Codex model and reasoning configuration unless overridden. Direct resolves explicit options, Codex config, the model cache, then a compatibility fallback. Current Direct text can use `gpt-5.6-sol` with medium or high reasoning. The private Responses Lite route does not expose hosted `image_generation`, so Direct image requests preflight to the compatible classic `gpt-5.5`. This is a limitation of the unofficial Direct image protocol, not a claim that `gpt-5.6-sol` lacks vision capability.
146
+
147
+ ## Development and releases
148
+
149
+ ```bash
150
+ npm install
151
+ npm run verify
152
+ ```
153
+
154
+ `verify` runs lint, workflow checks, type checking, tests, build, package inspection, and a clean install/import smoke test. Live Direct endpoint tests are manual-only: `RUN_DIRECT_E2E=1 npm run test:e2e`.
155
+
156
+ Every push to `main` publishes a patch release. See [release setup](./docs/RELEASING.md).
157
+
158
+ The Direct backend derives in part from MIT-licensed [`lawrencewzen/imgen`](https://github.com/lawrencewzen/imgen); see [third-party notices](./THIRD_PARTY_NOTICES.md).
159
+
160
+ MIT © 2026 ye.wang
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAMV,YAAY,EAEZ,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACX,oBAAoB,EACrB,MAAM,YAAY,CAAC;AA0EpB,wBAAsB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA0C5E;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAwB9E;AAwDD,wBAAsB,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CA0BhF;AA4CD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAqChF;AAsBD,wBAAuB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAavF;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAWlE"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAMV,YAAY,EAEZ,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACX,oBAAoB,EACrB,MAAM,YAAY,CAAC;AA0EpB,wBAAsB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CA6C5E;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CA0B9E;AAwDD,wBAAsB,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CA8BhF;AA4CD,wBAAsB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CA6ChF;AAsBD,wBAAuB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,CAavF;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAWlE"}