@operad-io/harness-codex 0.0.1 → 0.1.1
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 +7 -101
- package/package.json +5 -5
- package/src/access.ts +1 -1
- package/src/index.ts +3 -2
- package/src/install.ts +1 -1
package/README.md
CHANGED
|
@@ -1,107 +1,13 @@
|
|
|
1
1
|
# @operad-io/harness-codex
|
|
2
2
|
|
|
3
|
-
The
|
|
4
|
-
talks ACP to it, and the `codex:prompt` flow that runs one prompt. Decisions:
|
|
5
|
-
`docs/backlog/operad-harness.md` 2, 6, 8, 9 and 10.
|
|
3
|
+
**The codex harness.** Starts your own `codex-acp` and talks ACP to it, to run a prompt as one agent step.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
another harness that speaks ACP reuses it. `runAgent` owns the process, the
|
|
9
|
-
wall time and the stall limit; `AcpClient` is only the protocol.
|
|
5
|
+
This package is part of [operad](https://github.com/operad-io/operad). Most people install only [`@operad-io/cli`](https://www.npmjs.com/package/@operad-io/cli).
|
|
10
6
|
|
|
11
|
-
##
|
|
7
|
+
## Documentation
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
mode, the model and the reasoning effort, then `session/prompt`. Each
|
|
17
|
-
`session/update` is turned into log lines. `session/cancel` is sent when the
|
|
18
|
-
step is cancelled; codex-acp answers the prompt with the stop reason
|
|
19
|
-
`cancelled`, and an agent that does not answer within `CANCEL_GRACE_MS` (10 s)
|
|
20
|
-
is ended. What `session/load` replays of the earlier conversation is neither
|
|
21
|
-
logged nor counted.
|
|
9
|
+
- User guide: [docs/user/dev.md](https://github.com/operad-io/operad/blob/main/docs/user/dev.md)
|
|
10
|
+
- Website: <https://operad.io>
|
|
11
|
+
- Developer reference: `REFERENCE.md` in this directory
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
None from operad. codex-acp uses the user's local Codex (ChatGPT) login as it
|
|
26
|
-
is. A session that needs a login fails with `not_logged_in`; run `codex login`.
|
|
27
|
-
|
|
28
|
-
## Settings
|
|
29
|
-
|
|
30
|
-
The `codex` section of `config.json`.
|
|
31
|
-
|
|
32
|
-
| setting | type | default | meaning |
|
|
33
|
-
|---|---|---|---|
|
|
34
|
-
| `model` | string | Codex's own | the model; the step's `--model` wins |
|
|
35
|
-
| `effort` | `minimal`, `low`, `medium`, `high`, `xhigh` | Codex's own | the reasoning effort; the step's `--effort` wins |
|
|
36
|
-
| `command` | array of strings | the `bun` of PATH on the real path of the `codex-acp` of PATH | the program and arguments that start codex-acp |
|
|
37
|
-
| `wallTimeSecs` | number | `3600` | the longest one run may take (at most 28500) |
|
|
38
|
-
| `stallSecs` | number | `600` | how long a run may be silent while no tool call is open |
|
|
39
|
-
| `concurrency` | object, model to positive integer | `{}` | how many runs of one model may go at once; a model not listed has no limit |
|
|
40
|
-
|
|
41
|
-
`command` is a list because the default is two words. codex-acp's shebang is
|
|
42
|
-
`#!/usr/bin/env node`, which finds a node only in a shell that set one up (fnm),
|
|
43
|
-
so the default runs the real path of `codex-acp` with `bun`. On the owner's
|
|
44
|
-
machine that is `["/opt/homebrew/bin/bun", "/Users/hai/.bun/bin/codex-acp"]`.
|
|
45
|
-
|
|
46
|
-
`operad plugin check codex` runs `codex-acp --version`, `codex --version` and
|
|
47
|
-
`codex login status`, and reports the two versions and the login kind. It
|
|
48
|
-
refuses, saying what to do, when codex-acp cannot start or Codex is not logged
|
|
49
|
-
in; a Codex it cannot find on PATH is reported as unknown, not refused.
|
|
50
|
-
|
|
51
|
-
## Step args
|
|
52
|
-
|
|
53
|
-
`--model <name>` and `--effort <level>` only; any other entry fails the step
|
|
54
|
-
with `invalid_args`, as for `pi` and `claude`. A model codex-acp does not offer
|
|
55
|
-
is a `model_error` of kind `unavailable`; an effort the model does not take is
|
|
56
|
-
`invalid_args`.
|
|
57
|
-
|
|
58
|
-
## The sandbox
|
|
59
|
-
|
|
60
|
-
Codex's own sandbox stays on. The session mode is `workspace-write` (`SESSION_MODE`):
|
|
61
|
-
write access to the worktree and nothing outside it. The sandbox cannot write
|
|
62
|
-
`.git`, so a flow that needs a commit uses the work stage's `commit`
|
|
63
|
-
(`operad-dev-flows.md` decision 9). The sandbox has no network; a command that
|
|
64
|
-
needs it comes to the client as a permission request, and the access profile
|
|
65
|
-
answers it (a network request is allowed once, since the task needs it).
|
|
66
|
-
|
|
67
|
-
## Permissions
|
|
68
|
-
|
|
69
|
-
`session/request_permission` is answered by `decideAccess` (`src/access.ts`),
|
|
70
|
-
the same rules the other harnesses apply through `access-match`: a deny wins; a
|
|
71
|
-
one-time permission covers one exact refused call and is used through the host
|
|
72
|
-
(`ctx.useGrant`, the same `grant_use` and `grant_ack` the worker protocol
|
|
73
|
-
carries) before the call is let through; a call the profile says must ask goes
|
|
74
|
-
to a person through `ctx.ask`. An allowed call gets the `allow_once` option,
|
|
75
|
-
never `allow_always`. The request is read by its ACP tool `kind`: `execute`
|
|
76
|
-
with a command is a `bash` call; `edit`, `delete` and `move` judge each path in
|
|
77
|
-
`locations` as an `edit`; `read` and `search` judge their path; `fetch`, `think`
|
|
78
|
-
and a request of operad's own MCP server are inert; any other call is allowed
|
|
79
|
-
only when the profile has no `denyPaths` and `denyCommands`.
|
|
80
|
-
|
|
81
|
-
Codex asks only about what leaves its sandbox. A command that runs inside the
|
|
82
|
-
sandbox is not asked about, so a profile's deny rules do not see it: Codex's
|
|
83
|
-
sandbox is the bound there, not the profile.
|
|
84
|
-
|
|
85
|
-
## Usage, images, time
|
|
86
|
-
|
|
87
|
-
- Tokens come from the prompt's `usage`. The cost is unknown for a subscription
|
|
88
|
-
login: `costMicros` and `costQuality` are `null`, never `0`, and nothing in
|
|
89
|
-
`dev` or `pool` stops or blocks on it.
|
|
90
|
-
- Each image generation (a tool call titled `Image generation`) is counted per
|
|
91
|
-
attempt in `imageGenCalls` of the step result and of the closing `result`
|
|
92
|
-
line of the log.
|
|
93
|
-
- Every tool call is in the step log as `tool_execution_start`, `tool_output`
|
|
94
|
-
(the head, cut at 64 KB) and `tool_execution_end`; an assistant message is
|
|
95
|
-
`text_delta` lines and a closing `message_end`; a refused call is a `blocked`
|
|
96
|
-
line. A rework reads these.
|
|
97
|
-
- There is no stall detection of its own. The stall limit pauses while a tool
|
|
98
|
-
call or a permission question is open, so an image generation that prints
|
|
99
|
-
nothing for minutes is never a stall; the wall limit still applies.
|
|
100
|
-
- `usageLimitExceeded` and `rateLimitExceeded` of Codex are a `model_error` of
|
|
101
|
-
kind `usage_limit`; `serverOverloaded` is `unavailable`. With no fallback
|
|
102
|
-
configured the task waits (`operad-worker-pool.md` decision 10).
|
|
103
|
-
|
|
104
|
-
## Not done
|
|
105
|
-
|
|
106
|
-
Messages sent to a run while it works (the inbox) are not passed on. The chat
|
|
107
|
-
does not offer `codex`: it declares no models and no efforts.
|
|
13
|
+
MIT licensed.
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operad-io/harness-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@operad-io/access-match": "0.
|
|
10
|
-
"@operad-io/engine": "0.
|
|
11
|
-
"@operad-io/harness-process": "0.
|
|
9
|
+
"@operad-io/access-match": "0.1.1",
|
|
10
|
+
"@operad-io/engine": "0.1.1",
|
|
11
|
+
"@operad-io/harness-process": "0.1.1"
|
|
12
12
|
},
|
|
13
|
-
"description": "operad: the codex harness, a client of the codex-acp adapter
|
|
13
|
+
"description": "operad: the codex harness, a client of the codex-acp adapter",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/operad-io/operad.git",
|
package/src/access.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The access profile applied to the calls codex asks permission for
|
|
3
|
-
* (
|
|
3
|
+
* (ADR 0022 D4).
|
|
4
4
|
*
|
|
5
5
|
* codex-acp sends `session/request_permission` for a command that leaves the
|
|
6
6
|
* sandbox, a file change and a network request. The request describes the call
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The codex harness: one `agent` step that starts the user's `codex-acp` and
|
|
3
|
-
* talks ACP to it (
|
|
3
|
+
* talks ACP to it (ADR 0022 D2, D8), plus the
|
|
4
4
|
* `codex:prompt` flow. The step has the params, result names and facts of
|
|
5
5
|
* `pi/agent` and `claude/agent`, so a flow changes harness by changing `use`.
|
|
6
6
|
* The ACP client is `AcpClient` of `@operad-io/harness-process`; `runAgent`
|
|
7
7
|
* owns the process, the wall time and the stall limit.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import pkg from "../package.json" with { type: "json" };
|
|
10
11
|
import { readProfile, secretValuesOf, summarizeCall, type AccessProfile } from "@operad-io/access-match";
|
|
11
12
|
import {
|
|
12
13
|
isRecord,
|
|
@@ -263,7 +264,7 @@ export function createCodexHarnessPlugin(options: CodexHarnessOptions = {}) {
|
|
|
263
264
|
return definePlugin({
|
|
264
265
|
name: HARNESS,
|
|
265
266
|
kind: "harness",
|
|
266
|
-
version:
|
|
267
|
+
version: pkg.version,
|
|
267
268
|
models: CODEX_MODELS,
|
|
268
269
|
efforts: CODEX_EFFORTS,
|
|
269
270
|
settings: PLUGIN_SETTINGS,
|
package/src/install.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The user's own `codex-acp` and Codex: found, never bundled
|
|
3
|
-
* (
|
|
3
|
+
* (ADR 0022 D6, D8). `inspectCodex` is what
|
|
4
4
|
* `operad plugin check` runs: `codex-acp --version`, `codex --version` and
|
|
5
5
|
* `codex login status`. Credentials are the user's own Codex (ChatGPT) login;
|
|
6
6
|
* operad never reads or writes them.
|