@discovery-tree/runner 0.1.19 → 0.1.21

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.
Files changed (3) hide show
  1. package/README.md +35 -14
  2. package/dist/cli.js +718 -94
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -290,15 +290,39 @@ reads Cursor's credential files: "signed in" is whatever `cursor-agent status` s
290
290
  **`CURSOR_API_KEY` in the runner's environment makes the CLI sign in with that key** instead of
291
291
  your `cursor-agent login`. `dt-runner doctor` and `dt-runner start` warn when it is set.
292
292
 
293
- Headless, the Cursor CLI asks no questions: there are no permission prompts to approve in
294
- Discovery Tree, and the tool rules above (`allowedTools`, saved and inherited rules) do not apply
295
- to Cursor. Its own permission rules (`~/.cursor/cli-config.json`, and the repository's
296
- `.cursor/cli.json`) decide which commands and file writes it may make; what they do not allow is
297
- not done, which can leave a run unable to finish its task. To let it do anything:
298
-
299
- | Key | Default | Meaning |
300
- | ------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
301
- | `cursorForce` | `false` | Pass `--force`: Cursor runs commands and writes files without asking, past its permission rules. `dt-runner start` warns when on. |
293
+ Headless, the Cursor CLI asks no questions mid-turn: a shell command its permission rules (or
294
+ its auto-review) do not allow is rejected, because print mode cannot stop to ask. Each turn
295
+ passes `--trust` so a fresh session worktree is trusted without an interactive prompt, and
296
+ `--sandbox enabled` so commands and file writes stay in that worktree. Despite the sandbox, a
297
+ command the CLI's allow-list does not name can still be rejected (the CLI's default allow-list
298
+ is only `Shell(ls)`), so the runner does not count on the sandbox to let one through.
299
+
300
+ **A rejected shell command is offered in Discovery Tree** as a denial, with a rule in the CLI's
301
+ own syntax, which names a command by its first word: `.venv/bin/python scripts/x.py` offers
302
+ `Shell(.venv/bin/python)`. **Allow once** applies it for the rest of the run; **Always allow**
303
+ saves it for the repository, with Claude Code's rules (each agent reads only its own syntax).
304
+ Before each turn, the runner adds the run's and the repository's `Shell(...)` rules to the
305
+ worktree's `.cursor/cli.json` `permissions.allow`, the CLI's project-level rules, keeping the
306
+ repository's own entries. The file is kept out of what the agent commits (excluded from git, or
307
+ marked `skip-worktree` when the repository tracks it), and the agent cannot edit it: the CLI
308
+ refuses an agent's write to its permission files. The runner's other tool rules
309
+ (`allowedTools`, inherited rules) are Claude Code's and do not apply to Cursor. The CLI's
310
+ global rules (`~/.cursor/cli-config.json`) still apply, and a deny rule there or in the
311
+ repository's file is never overridden. The same `--sandbox` flag is passed when a turn continues
312
+ with `--resume`.
313
+
314
+ The CLI keeps network separate from that sandbox, and a turn has no network flag (only
315
+ `agent sandbox run --network`, which is not how a turn is started). The runner does not set
316
+ `sandbox.networkAccess` and does not edit `~/.cursor/cli-config.json`, so network stays at the
317
+ CLI's own setting. That defaults to `user_config_with_defaults`: the sandbox's built-in domain
318
+ allowlist plus anything in `sandbox.json`, not open network (`allow_all`). The workspace sandbox
319
+ also still allows its own temp directory (`/tmp` on Linux). `cursorForce` is what drops the
320
+ sandbox.
321
+
322
+ | Key | Default | Meaning |
323
+ | --------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
324
+ | `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. |
325
+ | `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. |
302
326
 
303
327
  Interrupting a Cursor turn stops its process (and what it started); the next message resumes the
304
328
  chat. Planning requests are still answered by Claude Code.
@@ -454,11 +478,8 @@ used by the integration tests.
454
478
  workflow (`.github/workflows/publish-runner.yml`), never from a laptop.
455
479
 
456
480
  1. Bump `version` in `packages/runner/package.json` in a pull request and merge it to `main`.
457
- 2. Publish: merge an update to `packages/runner/publish-request.txt` on `main` (sets the
458
- version line to match `package.json`), which dispatches **Publish dt-runner**; or run
459
- Actions → **Publish dt-runner** → **Run workflow** on `main` by hand. The workflow refuses a
460
- version that is already on npm, runs lint, typecheck, tests and the build, then publishes
461
- publicly.
481
+ 2. Actions → **Publish dt-runner** → **Run workflow** on `main`. It refuses a version that is
482
+ already on npm, runs lint, typecheck, tests and the build, then publishes publicly.
462
483
 
463
484
  The workflow runs in the `npm-publish` environment; add required reviewers there to gate
464
485
  releases.