@discovery-tree/runner 0.1.14 → 0.1.16
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 +97 -17
- package/dist/cli.js +2741 -1145
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,13 +44,13 @@ answer yes. If you answer no, nothing is saved; remove the runner in Discovery T
|
|
|
44
44
|
terminal to ask (stdin is not a TTY) the token is saved and the account is printed in a
|
|
45
45
|
banner. Check it.
|
|
46
46
|
|
|
47
|
-
| Command | What it does
|
|
48
|
-
| ----------------------------------------------------------------------------- |
|
|
49
|
-
| `dt-runner login [--server <url>] [--name <name>] [--yes]` | Pair with Discovery Tree (device code), then confirm the account.
|
|
50
|
-
| `dt-runner start [--max-sessions N] [--repos-dir <dir>] [--json] [--verbose]` | Run the daemon (one per configuration; a second `start` refuses to run).
|
|
51
|
-
| `dt-runner status` | Show the configuration and check the server (see below).
|
|
52
|
-
| `dt-runner doctor` | Check Node.js, git, Claude Code and
|
|
53
|
-
| `dt-runner logout` | Delete the saved config (and token). Remove the runner in Discovery Tree to revoke it.
|
|
47
|
+
| Command | What it does |
|
|
48
|
+
| ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
49
|
+
| `dt-runner login [--server <url>] [--name <name>] [--yes]` | Pair with Discovery Tree (device code), then confirm the account. |
|
|
50
|
+
| `dt-runner start [--max-sessions N] [--repos-dir <dir>] [--json] [--verbose]` | Run the daemon (one per configuration; a second `start` refuses to run). |
|
|
51
|
+
| `dt-runner status` | Show the configuration and check the server (see below). |
|
|
52
|
+
| `dt-runner doctor` | Check Node.js, git, Claude Code (and Codex and Cursor, if installed) and sign-in; warn about API keys. |
|
|
53
|
+
| `dt-runner logout` | Delete the saved config (and token). Remove the runner in Discovery Tree to revoke it. |
|
|
54
54
|
|
|
55
55
|
The runner only makes outbound HTTPS requests to the Discovery Tree server: a heartbeat every
|
|
56
56
|
15 seconds, a long poll for commands, and posts of session events. Nothing listens on a port.
|
|
@@ -78,7 +78,7 @@ readable only by you (mode 0600) because it holds the runner token. `login` writ
|
|
|
78
78
|
"maxSessions": 2,
|
|
79
79
|
"reposDir": "/path/to/clone/cache",
|
|
80
80
|
"worktreesDir": "/path/to/worktrees",
|
|
81
|
-
"permissionMode": "
|
|
81
|
+
"permissionMode": "auto",
|
|
82
82
|
"extraAllowedTools": ["Bash(docker compose *)"],
|
|
83
83
|
"extraDisallowedTools": ["Read(~/work/secrets/**)"],
|
|
84
84
|
"gitProtocol": "https",
|
|
@@ -91,7 +91,7 @@ readable only by you (mode 0600) because it holds the runner token. `login` writ
|
|
|
91
91
|
| `maxSessions` | `2` | Sessions with a running Claude Code at once (1 to 64). Further starts are refused as busy and retried by the server. `--max-sessions` overrides it. |
|
|
92
92
|
| `reposDir` | `$XDG_DATA_HOME/discovery-tree/runner/repos` | Clone cache. `--repos-dir` overrides it. |
|
|
93
93
|
| `worktreesDir` | `$XDG_DATA_HOME/discovery-tree/runner/worktrees` | One worktree per session. |
|
|
94
|
-
| `permissionMode` | `
|
|
94
|
+
| `permissionMode` | `auto` | Claude Code `--permission-mode`. See below. |
|
|
95
95
|
| `allowedTools` | a development allow-list | Replaces the default `--allowedTools` list. |
|
|
96
96
|
| `extraAllowedTools` | `[]` | Added to the allow-list. |
|
|
97
97
|
| `disallowedTools` | credential locations (see below) | Replaces the default `--disallowedTools` deny list. Deny rules win over the allow-list. |
|
|
@@ -120,7 +120,12 @@ server that does not ask for it, anything that would prompt is denied and the ag
|
|
|
120
120
|
it could not do it. Deny rules (below) are applied before Claude Code asks, so what they deny is
|
|
121
121
|
never offered to you. What it may do without asking:
|
|
122
122
|
|
|
123
|
-
- **`permissionMode: "
|
|
123
|
+
- **`permissionMode: "auto"`** (default): Claude Code's auto mode, as many people run their own
|
|
124
|
+
Claude Code: its classifier approves routine actions the allow-list does not name and asks
|
|
125
|
+
(relayed to you) about the rest. With a Claude Code that has no auto mode, the runner uses
|
|
126
|
+
`acceptEdits` instead.
|
|
127
|
+
- **`permissionMode: "acceptEdits"`**: file edits inside the worktree are allowed; any other
|
|
128
|
+
command not on the allow-list is asked about.
|
|
124
129
|
- **The allow-list** (`DEFAULT_ALLOWED_TOOLS` in `src/config.ts`): the file tools (`Read`,
|
|
125
130
|
`Edit`, `Write`, `Glob`, `Grep`, …) and the commands an agent needs to build and test a
|
|
126
131
|
change, in Claude Code's `Bash(<prefix> *)` syntax: `git status/diff/log/add/commit …`,
|
|
@@ -144,13 +149,20 @@ never offered to you. What it may do without asking:
|
|
|
144
149
|
agent is told to use another port. A server started this way ends with the Claude Code
|
|
145
150
|
process (at most `idleTimeoutMinutes` after the last turn, or when the runner stops): Claude
|
|
146
151
|
Code runs in a process group of its own, and the runner ends what is left in it however
|
|
147
|
-
Claude Code exited. On Windows, which has no process groups, the runner
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
Claude Code exited. On Windows, which has no process groups, the runner puts each Claude
|
|
153
|
+
Code in a Job Object of its own (held by one small PowerShell helper it starts), so
|
|
154
|
+
everything Claude Code starts stays in that job however its parents exit (an MCP server
|
|
155
|
+
whose `cmd.exe` wrapper was killed, a server started with `&` from a Git Bash shell that
|
|
156
|
+
exited at once), and ends the job when Claude Code has exited. It also ends any process
|
|
157
|
+
still descending from Claude Code by parent process id, or seen descending from it earlier
|
|
158
|
+
(it looks every 30 seconds, and once more just before it stops Claude Code), with
|
|
159
|
+
`taskkill /T /F`. Without PowerShell it falls back to those alone. An interrupted turn
|
|
160
|
+
leaves it running (unless Claude Code does not answer the interrupt and the SIGINT the
|
|
161
|
+
runner then sends ends it). It can be left running only if it moves itself out of that
|
|
162
|
+
group (`setsid`, a daemon; on Windows, a process started in the first moments of Claude
|
|
163
|
+
Code, before it is in its job, whose parent then exited unseen), or if the runner itself is
|
|
164
|
+
killed with SIGKILL (or the computer loses power). On Windows the jobs end with the runner
|
|
165
|
+
even when it is killed from Task Manager.
|
|
154
166
|
Left off on purpose: `WebFetch` and `WebSearch` (the easiest way for a manipulated agent to
|
|
155
167
|
send data out), `curl`, `kill`, `docker` and `sudo` (to start a database: run it
|
|
156
168
|
yourself beforehand, or add `"Bash(docker compose *)"` to `extraAllowedTools`; Docker access
|
|
@@ -222,6 +234,74 @@ The runner only clones from `https://github.com/<owner>/<repo>`: Discovery Tree
|
|
|
222
234
|
at another host. It passes Claude Code only a model name that looks like one (`sonnet`,
|
|
223
235
|
`opus[1m]`, `claude-opus-5-5`, …) and refuses the session otherwise.
|
|
224
236
|
|
|
237
|
+
## Running Codex
|
|
238
|
+
|
|
239
|
+
The runner can also run a session with the official [Codex CLI](https://github.com/openai/codex)
|
|
240
|
+
signed in on your computer, with your ChatGPT plan or your own OpenAI API key. Discovery Tree
|
|
241
|
+
starts a Codex session only when you choose Codex for a run; everything else (worktree, commits,
|
|
242
|
+
push, pull request, screenshots) is the same as for Claude Code.
|
|
243
|
+
|
|
244
|
+
1. Install it: `npm i -g @openai/codex` (or a release binary on your `PATH`; set
|
|
245
|
+
`DT_RUNNER_CODEX_BIN` to use a particular one).
|
|
246
|
+
2. Sign in: `codex login`. `codex login status` should say you are logged in.
|
|
247
|
+
3. Check: `dt-runner doctor` shows the Codex version and sign-in. Codex is optional: without it
|
|
248
|
+
the check is a note, not a failure, and the runner reports Codex as not ready to Discovery
|
|
249
|
+
Tree, which then refuses Codex runs on this computer with the reason.
|
|
250
|
+
|
|
251
|
+
Each turn is one `codex exec --json` process in the session's worktree; the next message
|
|
252
|
+
continues the conversation with `codex exec resume <thread_id>`. The runner never reads Codex's
|
|
253
|
+
credential files: "signed in" is whatever `codex login status` says.
|
|
254
|
+
|
|
255
|
+
**`OPENAI_API_KEY` or `CODEX_API_KEY` in the runner's environment bills that key**, not your
|
|
256
|
+
ChatGPT plan. `dt-runner doctor` and `dt-runner start` warn when either is set.
|
|
257
|
+
|
|
258
|
+
`codex exec` asks no questions: there are no permission prompts to approve in Discovery Tree,
|
|
259
|
+
and the tool rules above (`allowedTools`, saved and inherited rules) do not apply to Codex.
|
|
260
|
+
Codex's own sandbox is what keeps a run in its worktree:
|
|
261
|
+
|
|
262
|
+
| Key | Default | Meaning |
|
|
263
|
+
| -------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
264
|
+
| `codexSandbox` | `workspace-write` | `codex exec --sandbox`. `workspace-write`: commands may write in the worktree only. `danger-full-access`: no sandbox at all (warned at start). |
|
|
265
|
+
| `codexNetworkAccess` | `false` | With `workspace-write`, let commands reach the network (`npm install`, `gh pr view`): `-c sandbox_workspace_write.network_access=true`. |
|
|
266
|
+
|
|
267
|
+
Interrupting a Codex turn stops its process (and what it started); the next message resumes the
|
|
268
|
+
conversation. Planning requests are still answered by Claude Code.
|
|
269
|
+
|
|
270
|
+
## Running Cursor
|
|
271
|
+
|
|
272
|
+
The runner can also run a session with the [Cursor Agent CLI](https://cursor.com/cli) signed in
|
|
273
|
+
on your computer, when you choose "Cursor (your computer)" for a run. This is not Cursor Cloud
|
|
274
|
+
(Cursor's background agents, which Discovery Tree runs with a workspace key): the work happens
|
|
275
|
+
in a worktree on your computer, committed, pushed and turned into a pull request as for Claude
|
|
276
|
+
Code and Codex.
|
|
277
|
+
|
|
278
|
+
1. Install it: `curl https://cursor.com/install -fsS | bash` (it installs `cursor-agent`; newer
|
|
279
|
+
builds also as `agent`). Set `DT_RUNNER_CURSOR_BIN` to use a particular binary.
|
|
280
|
+
2. Sign in: `cursor-agent login`. `cursor-agent status` should say you are logged in.
|
|
281
|
+
3. Check: `dt-runner doctor` shows the Cursor Agent CLI version and sign-in. Cursor is optional:
|
|
282
|
+
without it the check is a note, not a failure, and Discovery Tree refuses Cursor runs on this
|
|
283
|
+
computer with the reason.
|
|
284
|
+
|
|
285
|
+
Each turn is one `cursor-agent -p --output-format stream-json` process in the session's
|
|
286
|
+
worktree; the next message continues the chat with `--resume <session_id>`. The runner never
|
|
287
|
+
reads Cursor's credential files: "signed in" is whatever `cursor-agent status` says.
|
|
288
|
+
|
|
289
|
+
**`CURSOR_API_KEY` in the runner's environment makes the CLI sign in with that key** instead of
|
|
290
|
+
your `cursor-agent login`. `dt-runner doctor` and `dt-runner start` warn when it is set.
|
|
291
|
+
|
|
292
|
+
Headless, the Cursor CLI asks no questions: there are no permission prompts to approve in
|
|
293
|
+
Discovery Tree, and the tool rules above (`allowedTools`, saved and inherited rules) do not apply
|
|
294
|
+
to Cursor. Its own permission rules (`~/.cursor/cli-config.json`, and the repository's
|
|
295
|
+
`.cursor/cli.json`) decide which commands and file writes it may make; what they do not allow is
|
|
296
|
+
not done, which can leave a run unable to finish its task. To let it do anything:
|
|
297
|
+
|
|
298
|
+
| Key | Default | Meaning |
|
|
299
|
+
| ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
300
|
+
| `cursorForce` | `false` | Pass `--force`: Cursor runs commands and writes files without asking, past its permission rules. `dt-runner start` warns when on. |
|
|
301
|
+
|
|
302
|
+
Interrupting a Cursor turn stops its process (and what it started); the next message resumes the
|
|
303
|
+
chat. Planning requests are still answered by Claude Code.
|
|
304
|
+
|
|
225
305
|
## Planning on your own Claude Code
|
|
226
306
|
|
|
227
307
|
Turn on **Plan on my own Claude Code** under Account settings → Local runners, and your
|