@discovery-tree/runner 0.1.20 → 0.1.22
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 +46 -10
- package/dist/cli.js +917 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,8 @@ readable only by you (mode 0600) because it holds the runner token. `login` writ
|
|
|
90
90
|
| ------------------------------ | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
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
|
| `maxJobs` | `2` | [Jobs](#jobs) run at once (1 to 16), apart from sessions. `--max-jobs` overrides it. |
|
|
93
|
+
| `jobLogRetentionDays` | `30` | Days an ended job's log files are kept (0: for good). `--job-log-retention-days` overrides it. See [Jobs](#jobs). |
|
|
94
|
+
| `jobDataRetentionDays` | `0` (kept for good) | Days an ended job's data folder is kept (0: for good). `--job-data-retention-days` overrides it. |
|
|
93
95
|
| `reposDir` | `$XDG_DATA_HOME/discovery-tree/runner/repos` | Clone cache. `--repos-dir` overrides it. |
|
|
94
96
|
| `worktreesDir` | `$XDG_DATA_HOME/discovery-tree/runner/worktrees` | One worktree per session. |
|
|
95
97
|
| `permissionMode` | `auto` | Claude Code `--permission-mode`. See below. |
|
|
@@ -290,16 +292,39 @@ reads Cursor's credential files: "signed in" is whatever `cursor-agent status` s
|
|
|
290
292
|
**`CURSOR_API_KEY` in the runner's environment makes the CLI sign in with that key** instead of
|
|
291
293
|
your `cursor-agent login`. `dt-runner doctor` and `dt-runner start` warn when it is set.
|
|
292
294
|
|
|
293
|
-
Headless, the Cursor CLI asks no questions:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
295
|
+
Headless, the Cursor CLI asks no questions mid-turn: a shell command its permission rules (or
|
|
296
|
+
its auto-review) do not allow is rejected, because print mode cannot stop to ask. Each turn
|
|
297
|
+
passes `--trust` so a fresh session worktree is trusted without an interactive prompt, and
|
|
298
|
+
`--sandbox enabled` so commands and file writes stay in that worktree. Despite the sandbox, a
|
|
299
|
+
command the CLI's allow-list does not name can still be rejected (the CLI's default allow-list
|
|
300
|
+
is only `Shell(ls)`), so the runner does not count on the sandbox to let one through.
|
|
301
|
+
|
|
302
|
+
**A rejected shell command is offered in Discovery Tree** as a denial, with a rule in the CLI's
|
|
303
|
+
own syntax, which names a command by its first word: `.venv/bin/python scripts/x.py` offers
|
|
304
|
+
`Shell(.venv/bin/python)`. **Allow once** applies it for the rest of the run; **Always allow**
|
|
305
|
+
saves it for the repository, with Claude Code's rules (each agent reads only its own syntax).
|
|
306
|
+
Before each turn, the runner adds the run's and the repository's `Shell(...)` rules to the
|
|
307
|
+
worktree's `.cursor/cli.json` `permissions.allow`, the CLI's project-level rules, keeping the
|
|
308
|
+
repository's own entries. The file is kept out of what the agent commits (excluded from git, or
|
|
309
|
+
marked `skip-worktree` when the repository tracks it), and the agent cannot edit it: the CLI
|
|
310
|
+
refuses an agent's write to its permission files. The runner's other tool rules
|
|
311
|
+
(`allowedTools`, inherited rules) are Claude Code's and do not apply to Cursor. The CLI's
|
|
312
|
+
global rules (`~/.cursor/cli-config.json`) still apply, and a deny rule there or in the
|
|
313
|
+
repository's file is never overridden. The same `--sandbox` flag is passed when a turn continues
|
|
314
|
+
with `--resume`.
|
|
315
|
+
|
|
316
|
+
The CLI keeps network separate from that sandbox, and a turn has no network flag (only
|
|
317
|
+
`agent sandbox run --network`, which is not how a turn is started). The runner does not set
|
|
318
|
+
`sandbox.networkAccess` and does not edit `~/.cursor/cli-config.json`, so network stays at the
|
|
319
|
+
CLI's own setting. That defaults to `user_config_with_defaults`: the sandbox's built-in domain
|
|
320
|
+
allowlist plus anything in `sandbox.json`, not open network (`allow_all`). The workspace sandbox
|
|
321
|
+
also still allows its own temp directory (`/tmp` on Linux). `cursorForce` is what drops the
|
|
322
|
+
sandbox.
|
|
323
|
+
|
|
324
|
+
| Key | Default | Meaning |
|
|
325
|
+
| --------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
326
|
+
| `cursorSandbox` | `true` | Pass `--sandbox enabled` on every turn, a resumed one included. `false` passes `--sandbox disabled`: the allow-list decides again, and a command it does not name (Python included) is not run. |
|
|
327
|
+
| `cursorForce` | `false` | Pass `--force` as well. Cursor then runs commands and writes files without asking, on the whole computer, past the sandbox. `dt-runner start` warns when on. |
|
|
303
328
|
|
|
304
329
|
Interrupting a Cursor turn stops its process (and what it started); the next message resumes the
|
|
305
330
|
chat. Planning requests are still answered by Claude Code.
|
|
@@ -332,9 +357,20 @@ it leaves it running (the session's worktree stays until the job ends, then goes
|
|
|
332
357
|
runner's own (secrets in memory only, redacted from what is posted; never the runner's
|
|
333
358
|
token). On macOS and Linux the command runs in `/bin/sh`, in a process group of its own; on
|
|
334
359
|
Windows in Windows PowerShell (`powershell.exe`).
|
|
360
|
+
- **Its data folder.** Each job gets `<state>/jobs/<job id>/data/` (owner-only), its path in
|
|
361
|
+
`DT_JOB_DATA_DIR`, for what it produces (a recording, a report). It is outside every
|
|
362
|
+
session's checkout, so it stays when the checkout is removed (7 days after the job ends),
|
|
363
|
+
and a job taken up after a restart keeps it. Agents are told to write there, and to run
|
|
364
|
+
Python from a `.venv` in the folder the job runs in (`.venv/bin/python`, on Windows
|
|
365
|
+
`.venv\Scripts\python.exe`) rather than `python` from PATH.
|
|
335
366
|
- **Its log.** Everything it writes is in `<state>/jobs/<job id>/stdout.log` and `stderr.log`
|
|
336
367
|
(`dt-runner status` prints the state folder), kept after it ends. The runner posts the lines
|
|
337
368
|
to Discovery Tree, which keeps the newest 2,000.
|
|
369
|
+
- **Cleaning up.** When the runner starts, and once a day after, it removes the log files of
|
|
370
|
+
jobs that ended more than `jobLogRetentionDays` ago (default 30; 0 keeps them) and whose
|
|
371
|
+
last report reached Discovery Tree, and logs what it removed. Their data folders are kept
|
|
372
|
+
unless you set `jobDataRetentionDays`; a job's small `job.json` record always stays. A job
|
|
373
|
+
still running, or still reporting, is never touched.
|
|
338
374
|
- **Stopping it.** Stop it in Discovery Tree: the runner asks it to end (SIGTERM to its group;
|
|
339
375
|
`taskkill /T` on Windows) and kills what is left of it 10 seconds later.
|
|
340
376
|
- **The runner stopping.** Jobs keep running when the runner stops or restarts; the next
|