codex-task 0.2.4 → 0.2.5
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/.codex-plugin/plugin.json +1 -1
- package/README.md +27 -20
- package/README_EN.md +15 -13
- package/package.json +1 -1
- package/scripts/service/install.sh +22 -0
- package/scripts/service/uninstall.sh +22 -0
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# CodexTask
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 给 Agent 和自动化脚本用的 Codex 任务运行器:输入文本、图片或项目目录,拿回文本、生成图片或工作区改动。
|
|
4
4
|
|
|
5
5
|
[English](./README_EN.md) · [产品需求文档](./docs/PRD.md) · [远程部署与手机调用](./docs/knowhow/20260811_远程服务部署与移动端调用.md) · [常用命令](./docs/常用命令.txt) · [Companion Skill](./skills/codex-task/SKILL.md)
|
|
6
6
|
|
|
7
|
-
CodexTask
|
|
7
|
+
CodexTask 让 Codex、Claude Code、Gemini CLI 或你自己的程序把任务交给独立的 Codex worker。它提供 CLI、TypeScript API、Companion Skill 和可选的自托管 HTTP 服务,复用现有 Codex 登录,不需要另配 API key。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
先按期望结果选命令:
|
|
10
10
|
|
|
11
11
|
| 期望结果 | 命令 | 可组合输入 | 典型任务 |
|
|
12
12
|
| --- | --- | --- | --- |
|
|
@@ -27,7 +27,7 @@ npm install -g codex-task
|
|
|
27
27
|
codex-task doctor
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
下面用一份“健身营养餐”演示文生图、图生文、图生图、工作区任务和恢复。图片与 JSON 都来自真实模型请求;生成模型有随机性,重新执行会得到同类但不同的结果。
|
|
31
31
|
|
|
32
32
|
### 1. 生成图片:一份健身营养餐
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ codex-task doctor
|
|
|
35
35
|
codex-task image "生成一份写实、干净的健身营养餐:香煎鸡胸肉、糙米、西兰花、牛油果;四种食物分区摆放,俯拍,完整餐盘,食材边界清晰;浅灰桌面,柔和自然光;不要文字、水印、餐具和其他食物。" -o ./docs/assets/fitness-meal.png --size 1024x1024 --quality high
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
这里用 `--output` 把图片保存到 README 资产目录。省略该参数时,图片默认保存在当前目录:
|
|
39
39
|
|
|
40
40
|
```json
|
|
41
41
|
{
|
|
@@ -64,7 +64,7 @@ codex-task text "识别图片中的全部食物,估算每项可食部分重量
|
|
|
64
64
|
|
|
65
65
|
<img src="./docs/assets/fitness-meal.png" alt="CodexTask 图生文输入图片" width="520">
|
|
66
66
|
|
|
67
|
-
`text`
|
|
67
|
+
`text` 支持文生文、图生文和图文生文。下面是该命令返回的结构化内容,原始文件见 [`fitness-meal-analysis.json`](./docs/examples/fitness-meal-analysis.json):
|
|
68
68
|
|
|
69
69
|
```json
|
|
70
70
|
{
|
|
@@ -143,7 +143,7 @@ codex-task resume 7dd7a7d7-... "按单人份展示" -f ./copy-guidelines.md -i .
|
|
|
143
143
|
}
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
##
|
|
146
|
+
## 组合输入
|
|
147
147
|
|
|
148
148
|
位置 prompt、重复的 `-f/--prompt-file`、非空 stdin 和重复的 `-i/--image` 可以同时出现:
|
|
149
149
|
|
|
@@ -151,7 +151,7 @@ codex-task resume 7dd7a7d7-... "按单人份展示" -f ./copy-guidelines.md -i .
|
|
|
151
151
|
printf '%s' "总热量控制在 700 kcal 内" | codex-task text "制定调整建议" -f ./training-goal.md -f ./allergies.md -i ./meal-front.png -i ./meal-side.png
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
输入顺序固定为:位置 prompt → prompt 文件(按命令行顺序)→ stdin;图片保持 `-i` 的顺序。每份文件都带绝对路径边界标记,避免多份长 prompt 混在一起。每张图片不超过 20 MiB,总和不超过 50 MiB。
|
|
155
155
|
|
|
156
156
|
## 两种后端
|
|
157
157
|
|
|
@@ -175,7 +175,7 @@ approval: never
|
|
|
175
175
|
network: true
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
默认配置下,worker 可以访问工作区外路径、执行命令并联网,而且不会等待权限确认。只委派可信 prompt 和可信项目;需要限制范围时传 `--sandbox workspace-write` 或 `--no-network`。
|
|
179
179
|
|
|
180
180
|
## 图片输出与临时文件
|
|
181
181
|
|
|
@@ -194,9 +194,9 @@ codex-task gc
|
|
|
194
194
|
|
|
195
195
|
## 安装给其他 Agent
|
|
196
196
|
|
|
197
|
-
仓库内置 [`skills/codex-task/SKILL.md`](./skills/codex-task/SKILL.md)
|
|
197
|
+
仓库内置 [`skills/codex-task/SKILL.md`](./skills/codex-task/SKILL.md)。这个 Skill 供调用方 Agent 使用,教它何时运行 `text`、`image`、`task` 或 `resume`。底层 Codex worker 不会加载它。
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
SkillTruck 负责安装 Skill,npm 负责安装可执行命令。安装 Skill 不会自动全局安装 npm 包。
|
|
200
200
|
|
|
201
201
|
```bash
|
|
202
202
|
npm install -g skilltruck codex-task
|
|
@@ -207,7 +207,7 @@ skilltruck install https://github.com/wangyendt/codex-task --global
|
|
|
207
207
|
|
|
208
208
|
## 手机远程调用与开机自启
|
|
209
209
|
|
|
210
|
-
`codex-task serve` 把四类任务开放为带 Bearer Token 的异步 HTTP API
|
|
210
|
+
`codex-task serve` 把四类任务开放为带 Bearer Token 的异步 HTTP API。服务收到任务后立即返回 `jobId`,手机再轮询状态,不需要维持一个可能持续数分钟的请求。
|
|
211
211
|
|
|
212
212
|
| 目标 | 接口 |
|
|
213
213
|
| --- | --- |
|
|
@@ -218,19 +218,26 @@ skilltruck install https://github.com/wangyendt/codex-task --global
|
|
|
218
218
|
| 查询进度 | `GET /v1/jobs/:jobId` |
|
|
219
219
|
| 下载产物 | `GET /v1/jobs/:jobId/artifacts/:index` |
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
开机服务使用 `npm install -g codex-task@latest`。这样启动时不依赖 npm 网络,执行文件路径也不会变化。三平台脚本会安装或升级全局包、生成随机 token、创建用户级自启动项并立即启动服务。
|
|
222
222
|
|
|
223
223
|
```bash
|
|
224
|
-
# Ubuntu
|
|
225
|
-
bash ./scripts/service/install
|
|
226
|
-
|
|
227
|
-
# macOS:LaunchAgent
|
|
228
|
-
bash ./scripts/service/install-macos.sh
|
|
224
|
+
# Ubuntu/Linux 或 macOS:自动识别 systemd user / LaunchAgent
|
|
225
|
+
bash ./scripts/service/install.sh
|
|
229
226
|
|
|
230
227
|
# Windows PowerShell:Scheduled Task
|
|
231
228
|
powershell -ExecutionPolicy Bypass -File .\scripts\service\Install-Windows.ps1
|
|
232
229
|
```
|
|
233
230
|
|
|
231
|
+
卸载自启动服务但保留全局 npm 包、Codex 登录和任务数据:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Ubuntu/Linux 或 macOS
|
|
235
|
+
bash ./scripts/service/uninstall.sh
|
|
236
|
+
|
|
237
|
+
# Windows PowerShell
|
|
238
|
+
powershell -ExecutionPolicy Bypass -File .\scripts\service\Uninstall-Windows.ps1
|
|
239
|
+
```
|
|
240
|
+
|
|
234
241
|
默认监听 `0.0.0.0:7777` 以便手机访问,安装完成会打印 token。手机地址应填写电脑的局域网/VPN 地址,例如 `http://192.168.1.50:7777`,不能填写 `0.0.0.0`。
|
|
235
242
|
|
|
236
243
|
```bash
|
|
@@ -242,7 +249,7 @@ curl -sS http://127.0.0.1:7777/v1/jobs/替换为jobId -H "Authorization: Bearer
|
|
|
242
249
|
> [!CAUTION]
|
|
243
250
|
> 服务不内置 TLS,不能直接暴露到公网。建议只在可信局域网、Tailscale/WireGuard 或 HTTPS 反向代理后使用。Token 持有者实际上拥有该电脑上 CodexTask 的执行权;远程 `task` 默认仍是 `danger-full-access`、可联网、`approval: never`。服务重启会丢失内存中的远程 job 查询记录,终态 job 和下载链接默认保留 24 小时;已返回的 SDK `taskId` 仍可按 CodexTask 自身状态恢复。
|
|
244
251
|
|
|
245
|
-
Android Kotlin 与 iOS Swift
|
|
252
|
+
Android Kotlin 与 iOS Swift 示例见 [`examples/mobile`](./examples/mobile/README.md):先调用 `image` 生成营养餐,下载图片后调用 `text` 做图生文,再用 `task` 修改服务器上的项目;如果 worker 追问,就用 `resume` 回答。部署、升级、卸载、JSON 字段和安全说明见[远程服务部署与移动端调用](./docs/knowhow/20260811_远程服务部署与移动端调用.md)。
|
|
246
253
|
|
|
247
254
|
## TypeScript API
|
|
248
255
|
|
|
@@ -288,7 +295,7 @@ stdout 默认只有一个 JSON 结果;`--stream` 时为 JSONL。诊断写 stde
|
|
|
288
295
|
|
|
289
296
|
SDK 默认不覆写 model/reasoning,继续读取正常的 Codex 用户与项目配置。
|
|
290
297
|
|
|
291
|
-
Direct 按显式参数 → Codex `config.toml` → `models_cache.json` 首选模型 → 兼容 fallback 的顺序选择模型。当前文本可使用 `gpt-5.6-sol + medium/high`;私有 Responses Lite 路由不暴露托管 `image_generation`,所以 Direct 图片会在请求前选择兼容的 classic `gpt-5.5
|
|
298
|
+
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`。
|
|
292
299
|
|
|
293
300
|
运行 `codex-task doctor` 可查看本机 Direct transport、OAuth、模型解析、Codex CLI/SDK 与真实数据路径,不会发送模型请求。
|
|
294
301
|
|
package/README_EN.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# CodexTask
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> A Codex task runner for agents and automation scripts. Send text, images, or a project directory; receive text, generated images, or workspace changes.
|
|
4
4
|
|
|
5
5
|
[中文](./README.md) · [Product requirements](./docs/PRD.md) · [Remote deployment](./docs/knowhow/20260811_远程服务部署与移动端调用.md) · [Common commands](./docs/常用命令.txt) · [Companion skill](./skills/codex-task/SKILL.md)
|
|
6
6
|
|
|
7
|
-
CodexTask
|
|
7
|
+
CodexTask lets Codex, Claude Code, Gemini CLI, or your own program hand work to an independent Codex worker. It includes a CLI, a TypeScript API, a companion skill, and an optional self-hosted HTTP service. It reuses your existing Codex login, so there is no separate API key to configure.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Pick the command that matches the result you need:
|
|
10
10
|
|
|
11
11
|
| Result | Command | Composable inputs |
|
|
12
12
|
| --- | --- | --- |
|
|
@@ -27,7 +27,7 @@ npm install -g codex-task
|
|
|
27
27
|
codex-task doctor
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
The images and nutrition JSON below came from real CodexTask model requests
|
|
30
|
+
The images and nutrition JSON below came from real CodexTask model requests. Generative results vary between runs.
|
|
31
31
|
|
|
32
32
|
Generate a fitness meal image:
|
|
33
33
|
|
|
@@ -93,7 +93,7 @@ If the result is `needs_input`, answer and resume the same Codex task:
|
|
|
93
93
|
codex-task resume 7dd7a7d7-... "Use a single serving" -f ./copy-guidelines.md -i ./expected-layout.png
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
##
|
|
96
|
+
## Combine text, files, and images
|
|
97
97
|
|
|
98
98
|
The positional prompt, repeated `-f/--prompt-file`, non-empty stdin, and repeated `-i/--image` may be combined:
|
|
99
99
|
|
|
@@ -105,7 +105,7 @@ Text is composed in a stable order: positional prompt, prompt files in command-l
|
|
|
105
105
|
|
|
106
106
|
## Direct and SDK backends
|
|
107
107
|
|
|
108
|
-
`text` and `image` default to Direct and may
|
|
108
|
+
`text` and `image` default to Direct and may select `--backend sdk`. `task` and `resume` are SDK-only. CodexTask uses the backend you select; it does not guess.
|
|
109
109
|
|
|
110
110
|
| Capability | `direct` | `sdk` |
|
|
111
111
|
| --- | --- | --- |
|
|
@@ -117,7 +117,7 @@ Text is composed in a stable order: positional prompt, prompt files in command-l
|
|
|
117
117
|
|
|
118
118
|
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.
|
|
119
119
|
|
|
120
|
-
SDK tasks default to `sandbox=danger-full-access`, `approval=never`, and `network=true`.
|
|
120
|
+
SDK tasks default to `sandbox=danger-full-access`, `approval=never`, and `network=true`. With these settings, the worker can access paths outside the workspace, run commands, and use the network without waiting for approval. Delegate only trusted prompts and projects; use `--sandbox workspace-write` or `--no-network` when needed.
|
|
121
121
|
|
|
122
122
|
## Image output
|
|
123
123
|
|
|
@@ -130,7 +130,7 @@ Image controls: `size=auto|WIDTHxHEIGHT` (longest edge ≤ 3840), `quality=auto|
|
|
|
130
130
|
|
|
131
131
|
## Companion skill
|
|
132
132
|
|
|
133
|
-
[`skills/codex-task/SKILL.md`](./skills/codex-task/SKILL.md) teaches
|
|
133
|
+
[`skills/codex-task/SKILL.md`](./skills/codex-task/SKILL.md) teaches the calling agent how to use CodexTask. The underlying Codex worker does not load it. SkillTruck installs the skill; npm installs the CLI.
|
|
134
134
|
|
|
135
135
|
```bash
|
|
136
136
|
npm install -g skilltruck codex-task
|
|
@@ -162,23 +162,25 @@ Default stdout is one JSON result; `--stream` produces JSONL item/task progress.
|
|
|
162
162
|
|
|
163
163
|
## Self-hosted service and mobile clients
|
|
164
164
|
|
|
165
|
-
`codex-task serve` exposes text, image, workspace, and resume work as authenticated asynchronous HTTP jobs.
|
|
165
|
+
`codex-task serve` exposes text, image, workspace, and resume work as authenticated asynchronous HTTP jobs. A boot service uses `npm install -g codex-task@latest` so startup does not depend on registry access and the executable path stays fixed.
|
|
166
166
|
|
|
167
167
|
| Platform | Installer | Startup mechanism |
|
|
168
168
|
| --- | --- | --- |
|
|
169
|
-
| Ubuntu | `bash ./scripts/service/install
|
|
170
|
-
| macOS | `bash ./scripts/service/install
|
|
169
|
+
| Ubuntu/Linux | `bash ./scripts/service/install.sh` | systemd user service |
|
|
170
|
+
| macOS | `bash ./scripts/service/install.sh` | LaunchAgent at login |
|
|
171
171
|
| Windows | `powershell -ExecutionPolicy Bypass -File .\scripts\service\Install-Windows.ps1` | Scheduled Task at login |
|
|
172
172
|
|
|
173
173
|
The installers bind to `0.0.0.0:7777`, generate a protected Service Token, and print both. A phone must use the computer's reachable LAN or VPN address, not `0.0.0.0`. The API provides `POST /v1/text`, `/v1/image`, `/v1/task`, `/v1/tasks/:taskId/resume`, plus job polling and authenticated artifact downloads.
|
|
174
174
|
|
|
175
|
+
Uninstall auto-start while preserving the global npm package and Codex data with `bash ./scripts/service/uninstall.sh` on Ubuntu/Linux/macOS, or `powershell -ExecutionPolicy Bypass -File .\scripts\service\Uninstall-Windows.ps1` on Windows.
|
|
176
|
+
|
|
175
177
|
The service has no built-in TLS and must not be exposed directly to the public internet. Use a trusted LAN, Tailscale/WireGuard, or an HTTPS reverse proxy. Treat the token as equivalent to the local user's CodexTask authority; remote workspace tasks still default to `danger-full-access`, network enabled, and approval `never`. Remote job polling state is in memory and is lost on service restart; terminal jobs and download URLs expire after 24 hours by default.
|
|
176
178
|
|
|
177
|
-
See the
|
|
179
|
+
See the [deployment and API guide](./docs/knowhow/20260811_远程服务部署与移动端调用.md) and the [Android Kotlin and iOS Swift examples](./examples/mobile/README.md). The sample generates an image, analyzes it as text, changes a server-side project, and resumes after a question.
|
|
178
180
|
|
|
179
181
|
## Models
|
|
180
182
|
|
|
181
|
-
SDK mode inherits normal Codex model and reasoning configuration unless overridden. Direct
|
|
183
|
+
SDK mode inherits the normal Codex model and reasoning configuration unless overridden. Direct checks explicit options, Codex config, the model cache, then a compatibility fallback. 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 use the compatible classic `gpt-5.5`. `gpt-5.6-sol` still supports vision; the incompatibility is limited to this unofficial Direct image protocol.
|
|
182
184
|
|
|
183
185
|
## Development and releases
|
|
184
186
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
|
5
|
+
echo "Install the CodexTask auto-start service for Ubuntu/Linux or macOS."
|
|
6
|
+
echo "Usage: bash scripts/service/install.sh"
|
|
7
|
+
exit 0
|
|
8
|
+
fi
|
|
9
|
+
if [[ $# -ne 0 ]]; then
|
|
10
|
+
echo "Usage: bash scripts/service/install.sh" >&2
|
|
11
|
+
exit 2
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
15
|
+
case "$(uname -s)" in
|
|
16
|
+
Darwin) exec bash "$script_dir/install-macos.sh" ;;
|
|
17
|
+
Linux) exec bash "$script_dir/install-ubuntu.sh" ;;
|
|
18
|
+
*)
|
|
19
|
+
echo "Unsupported platform. This installer supports Ubuntu/Linux and macOS; use Install-Windows.ps1 on Windows." >&2
|
|
20
|
+
exit 1
|
|
21
|
+
;;
|
|
22
|
+
esac
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
if [[ "${1:-}" == "--help" || "${1:-}" == "-h" ]]; then
|
|
5
|
+
echo "Uninstall the CodexTask auto-start service for Ubuntu/Linux or macOS."
|
|
6
|
+
echo "Usage: bash scripts/service/uninstall.sh"
|
|
7
|
+
exit 0
|
|
8
|
+
fi
|
|
9
|
+
if [[ $# -ne 0 ]]; then
|
|
10
|
+
echo "Usage: bash scripts/service/uninstall.sh" >&2
|
|
11
|
+
exit 2
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
15
|
+
case "$(uname -s)" in
|
|
16
|
+
Darwin) exec bash "$script_dir/uninstall-macos.sh" ;;
|
|
17
|
+
Linux) exec bash "$script_dir/uninstall-ubuntu.sh" ;;
|
|
18
|
+
*)
|
|
19
|
+
echo "Unsupported platform. This uninstaller supports Ubuntu/Linux and macOS; use Uninstall-Windows.ps1 on Windows." >&2
|
|
20
|
+
exit 1
|
|
21
|
+
;;
|
|
22
|
+
esac
|