@discovery-tree/runner 0.1.25 → 0.1.27
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/CHANGELOG.md +67 -0
- package/README.md +230 -13
- package/dist/cli.js +20510 -434
- package/dist/embed.js +11269 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@discovery-tree/runner` (`dt-runner`) are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
Semver major bumps apply when a documented invoke flag, config key, or install step is removed
|
|
9
|
+
or renamed without a compatibility shim (see the Local dt-runner board decision on breaking
|
|
10
|
+
releases). This release is **0.1.27**: changes are additive or fixes; nothing documented was
|
|
11
|
+
removed or renamed.
|
|
12
|
+
|
|
13
|
+
## [0.1.27] - 2026-12-02
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **Background commands keep a session alive** — a session whose agent left commands running in
|
|
18
|
+
the background (a dev server, a long build) is no longer stopped as idle, which ended those
|
|
19
|
+
commands with it. It is kept until it has been silent for a day. Helpers the agent starts
|
|
20
|
+
for itself (MCP servers) do not count.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **Background commands in the turn result** — a `result` event lists the commands still running
|
|
25
|
+
(`background`, `backgroundMore`: pid, command, start time), and the runner log says when
|
|
26
|
+
the set changes. Additive: older servers ignore the fields.
|
|
27
|
+
|
|
28
|
+
## [0.1.26] - 2026-12-01
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **`dt-runner api check`** — calls Discovery Tree MCP (`list_trees`) using a personal or
|
|
33
|
+
service API token; does not require runner pairing.
|
|
34
|
+
- **API token configuration** — `personalToken` and `serviceToken` in `runner.json`, with
|
|
35
|
+
`DT_PERSONAL_TOKEN`, `DT_SERVICE_TOKEN`, and optional `DT_MCP_URL` / `mcpUrl` overrides.
|
|
36
|
+
- **Local plan MCP helpers** (repository source only; not re-exported from the published npm
|
|
37
|
+
bundle): `connectTreeMcp`, `treeApiFromResolved`, `TreeTaskLifecycleClient`,
|
|
38
|
+
`taskLifecycleFromConnection`, and `parseLocalTaskBrief` (`release on failure` in task
|
|
39
|
+
descriptions).
|
|
40
|
+
- **README** — install prerequisites (Node 22, npm vs pnpm from clone), documented CLI exit
|
|
41
|
+
codes, and a walkthrough for one local plan step over MCP.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- **Clone install** — `packages/runner` uses `file:../contracts` so `npm install` in that folder
|
|
46
|
+
succeeds when the `packages/contracts` sibling is present (replacing `workspace:*`, which npm
|
|
47
|
+
cannot resolve outside the pnpm workspace).
|
|
48
|
+
- **CLI parsing** — unknown commands and options, invalid flag values, and usage errors print
|
|
49
|
+
`dt-runner: …` on stderr and exit **1** instead of throwing uncaught parse errors.
|
|
50
|
+
- **API token status** — `dt-runner status` and `api check` report misconfigured tokens instead
|
|
51
|
+
of crashing when `personalToken` or `serviceToken` in the config file is malformed.
|
|
52
|
+
- **Task lifecycle** — `releaseTask` failures surface to callers; release-on-failure brief
|
|
53
|
+
detection is case-insensitive and scoped to the phrase `release on failure`.
|
|
54
|
+
|
|
55
|
+
### Changed
|
|
56
|
+
|
|
57
|
+
- **Exit codes** — documented and stable: **0** success, **1** failure (usage, doctor, status,
|
|
58
|
+
`api check`, daemon lock, …), **130** second Ctrl+C while `start` is stopping. Scripts that
|
|
59
|
+
relied on a non-zero exit from an uncaught parser error should expect **1** with a stderr
|
|
60
|
+
message instead.
|
|
61
|
+
|
|
62
|
+
## [0.1.25] - 2026-12-01
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
|
|
66
|
+
- **Stop** — reliably ends local agent turns (Claude Code, Codex, Cursor) with escalating
|
|
67
|
+
interrupts when a single signal is not enough.
|
package/README.md
CHANGED
|
@@ -20,10 +20,127 @@ request included.
|
|
|
20
20
|
- Discovery Tree hands the runner no GitHub token either. Clones, fetches and pushes use your
|
|
21
21
|
normal git setup (credential helper, SSH agent, `gh auth setup-git`, …).
|
|
22
22
|
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
This section is everything you need before installing. It names the Node.js version, the
|
|
26
|
+
package manager for each install path, and every optional environment variable. Nothing
|
|
27
|
+
later in this file adds another install requirement.
|
|
28
|
+
|
|
29
|
+
### Node.js
|
|
30
|
+
|
|
31
|
+
**Node.js 22 or newer.** `packages/runner/package.json` sets `"engines": { "node": ">=22" }`.
|
|
32
|
+
`dt-runner doctor` fails on an older Node. Continuous integration and the publish workflow
|
|
33
|
+
use Node 22. The published bundle targets Node 22 and has no runtime dependencies.
|
|
34
|
+
|
|
35
|
+
### Package manager
|
|
36
|
+
|
|
37
|
+
- **Published package.** Use **npm**, the npm that ships with Node.js. No other package
|
|
38
|
+
manager is required:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx @discovery-tree/runner --help
|
|
42
|
+
npm install -g @discovery-tree/runner
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **From a clone of this repository** (maintainers and local agents). Use **pnpm 10.20.0**,
|
|
46
|
+
the `packageManager` field in the repository root `package.json`. Do not run `npm install`
|
|
47
|
+
or `yarn` in the clone: the lockfile is `pnpm-lock.yaml`, and `packages/runner` is a
|
|
48
|
+
workspace package. `@discovery-tree/contracts` is private and is not installed on its own.
|
|
49
|
+
The runner build inlines it from its TypeScript source, so install from the repository
|
|
50
|
+
root rather than from `packages/runner`.
|
|
51
|
+
|
|
52
|
+
Node's Corepack selects that pnpm. With Node.js 22 or newer:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
corepack enable
|
|
56
|
+
corepack prepare pnpm@10.20.0 --activate
|
|
57
|
+
pnpm --version
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`pnpm --version` prints `10.20.0`. Clone the repository if you do not already have it,
|
|
61
|
+
then install and build from the repository root:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/OrganismAI/discovery-tree.git
|
|
65
|
+
cd discovery-tree
|
|
66
|
+
pnpm install --frozen-lockfile
|
|
67
|
+
pnpm --filter @discovery-tree/runner build
|
|
68
|
+
node packages/runner/dist/cli.js --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`--frozen-lockfile` is what CI runs. It installs the lockfile as committed and stops if
|
|
72
|
+
that would need a different pnpm or a lockfile change. Skip the `git clone` and `cd`
|
|
73
|
+
lines when you are already in a clone. Run the install from the repository root, not
|
|
74
|
+
from `packages/runner`.
|
|
75
|
+
|
|
76
|
+
- **Runner package only (maintainers and CI).** To check the published layout without the full
|
|
77
|
+
monorepo, use two sibling folders `packages/contracts` and `packages/runner` (the runner's
|
|
78
|
+
`devDependencies` use `"@discovery-tree/contracts": "file:../contracts"`). Build
|
|
79
|
+
`packages/contracts` first so `dist/` exists, then:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cd packages/runner
|
|
83
|
+
npm install --no-audit --no-fund
|
|
84
|
+
npm run build
|
|
85
|
+
node dist/cli.js --help
|
|
86
|
+
node dist/cli.js --version
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
A global or `npx` install of `@discovery-tree/runner` is separate: after
|
|
90
|
+
`npm install -g @discovery-tree/runner`, invoke `dt-runner --help`. Vitest exercises this
|
|
91
|
+
path in `test/install-smoke.test.ts` (`pnpm --filter @discovery-tree/runner test install-smoke`).
|
|
92
|
+
|
|
93
|
+
PostgreSQL, Redis, and Clerk are prerequisites of the Discovery Tree web app. They are not
|
|
94
|
+
prerequisites of dt-runner.
|
|
95
|
+
|
|
96
|
+
### Other tools
|
|
97
|
+
|
|
98
|
+
| Tool | Required to install? |
|
|
99
|
+
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| git | Yes, to clone. Also required to run sessions; `doctor` fails when `git` is missing. |
|
|
101
|
+
| [Claude Code](https://docs.claude.com/en/docs/claude-code) | No. Required only to run Claude sessions: `claude` on `PATH`, signed in (`claude` once). |
|
|
102
|
+
| GitHub CLI (`gh`) | No. Optional. When you are signed in, the agent can read pull requests and the runner can open one as you. |
|
|
103
|
+
| Codex CLI | No. Optional. See [Running Codex](#running-codex). |
|
|
104
|
+
| Cursor Agent CLI | No. Optional. See [Running Cursor](#running-cursor). |
|
|
105
|
+
|
|
106
|
+
### Optional environment variables
|
|
107
|
+
|
|
108
|
+
None of these are required to install, and none are required to run after `dt-runner login`.
|
|
109
|
+
`login` writes the server and the token into the config file. Set a variable only to
|
|
110
|
+
override that.
|
|
111
|
+
|
|
112
|
+
| Variable | What it does |
|
|
113
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
114
|
+
| `DT_SERVER_URL` | Discovery Tree server. Default `https://discovery-tree-backend.onrender.com`. |
|
|
115
|
+
| `DT_RUNNER_TOKEN` | Runner token. Overrides the token in the config file. |
|
|
116
|
+
| `DT_PERSONAL_TOKEN` | Personal API token for Discovery Tree MCP (`dtp_…`). Overrides the file. |
|
|
117
|
+
| `DT_SERVICE_TOKEN` | Optional team automation token when no personal token is set. |
|
|
118
|
+
| `DT_MCP_URL` | MCP endpoint. Default `<server>/api/mcp`. |
|
|
119
|
+
| `DT_RUNNER_CLAUDE_BIN` | `claude` binary to run. Default: `claude` on `PATH`. |
|
|
120
|
+
| `DT_RUNNER_CODEX_BIN` | `codex` binary to run. Default: `codex` on `PATH`. |
|
|
121
|
+
| `DT_RUNNER_CURSOR_BIN` | Cursor Agent CLI binary. Default: `cursor-agent` on `PATH`, then `agent`. |
|
|
122
|
+
| `ANTHROPIC_API_KEY` | Leave unset unless Claude Code should bill this key instead of your subscription. `doctor` and `start` warn when it is set. |
|
|
123
|
+
| `OPENAI_API_KEY` | Leave unset unless Codex should bill this key instead of your ChatGPT plan. `doctor` and `start` warn when it is set. |
|
|
124
|
+
| `CODEX_API_KEY` | Same warning as `OPENAI_API_KEY`. When both are set, `doctor` names this one. |
|
|
125
|
+
| `CURSOR_API_KEY` | Leave unset unless the Cursor CLI should sign in with this key instead of `cursor-agent login`. `doctor` and `start` warn when it is set. |
|
|
126
|
+
| `XDG_CONFIG_HOME` | Unix: directory for `discovery-tree/runner.json`. Default `~/.config`. |
|
|
127
|
+
| `XDG_DATA_HOME` | Unix: clone cache and worktrees. Default `~/.local/share`. |
|
|
128
|
+
| `XDG_STATE_HOME` | Unix: session state. Default `~/.local/state`. |
|
|
129
|
+
| `CLAUDE_CONFIG_DIR` | Claude Code's config directory. The runner reads `$CLAUDE_CONFIG_DIR/.claude.json` for permission rules you already approved. Default: `~/.claude.json` in your home directory. |
|
|
130
|
+
|
|
131
|
+
On Windows the config file is `%APPDATA%\discovery-tree\runner.json` and the data and state
|
|
132
|
+
folders are under `%LOCALAPPDATA%\discovery-tree\`. Windows sets `APPDATA` and
|
|
133
|
+
`LOCALAPPDATA`; you do not set them to install.
|
|
134
|
+
|
|
135
|
+
`DT_JOB_DATA_DIR` is set by the runner for each job's data folder. It is not an install
|
|
136
|
+
setting.
|
|
137
|
+
|
|
23
138
|
## Install and run
|
|
24
139
|
|
|
25
|
-
|
|
26
|
-
|
|
140
|
+
With the [prerequisites](#prerequisites) in place (Node.js 22 or newer, npm for the published
|
|
141
|
+
package or pnpm 10.20.0 from a clone), sign in to
|
|
142
|
+
[Claude Code](https://docs.claude.com/en/docs/claude-code) before the first Claude session
|
|
143
|
+
(`claude` once).
|
|
27
144
|
|
|
28
145
|
```bash
|
|
29
146
|
npx @discovery-tree/runner login # pair this computer with your Discovery Tree account
|
|
@@ -44,13 +161,26 @@ answer yes. If you answer no, nothing is saved; remove the runner in Discovery T
|
|
|
44
161
|
terminal to ask (stdin is not a TTY) the token is saved and the account is printed in a
|
|
45
162
|
banner. Check it.
|
|
46
163
|
|
|
47
|
-
| Command
|
|
48
|
-
|
|
|
49
|
-
| `dt-runner login [--server <url>] [--name <name>] [--yes]`
|
|
50
|
-
| `dt-runner start
|
|
51
|
-
| `dt-runner status`
|
|
52
|
-
| `dt-runner doctor`
|
|
53
|
-
| `dt-runner logout`
|
|
164
|
+
| Command | What it does |
|
|
165
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
166
|
+
| `dt-runner login [--server <url>] [--name <name>] [--no-browser] [--yes]` | Pair with Discovery Tree (device code), then confirm the account. |
|
|
167
|
+
| `dt-runner start` (see `dt-runner start --help` for `--max-sessions`, `--max-jobs`, job retention, `--job-shell`, `--repos-dir`, `--json`, `--verbose`) | Run the daemon (one per configuration; a second `start` refuses to run). |
|
|
168
|
+
| `dt-runner status` | Show the configuration and check the server (see below). |
|
|
169
|
+
| `dt-runner doctor` | Check Node.js, git, Claude Code (and Codex and Cursor, if installed) and sign-in; warn about API keys. |
|
|
170
|
+
| `dt-runner logout` | Delete the saved config (and token). Remove the runner in Discovery Tree to revoke it. |
|
|
171
|
+
| `dt-runner api check` | Call Discovery Tree MCP with your API token and list how many trees you can see. |
|
|
172
|
+
|
|
173
|
+
### Exit codes
|
|
174
|
+
|
|
175
|
+
Scripts and CI can rely on the process exit code:
|
|
176
|
+
|
|
177
|
+
| Code | When |
|
|
178
|
+
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
179
|
+
| **0** | The command succeeded: for example `--version`, `--help`, `help`, a successful `logout`, or `doctor` with no failing checks. |
|
|
180
|
+
| **1** | The command failed: no subcommand (usage printed), unknown command or option, an invalid flag value, this computer is not paired yet, `doctor` found a failing check, `status` or `api check` could not verify the setup, or `start` could not take the daemon lock or the server refused the runner token. |
|
|
181
|
+
| **130** | You pressed Ctrl+C a second time while `dt-runner start` is already stopping. |
|
|
182
|
+
|
|
183
|
+
Unknown options and invalid numeric flags print `dt-runner: …` on stderr and exit **1**, the same as when you run `node packages/runner/dist/cli.js` after a build.
|
|
54
184
|
|
|
55
185
|
The runner only makes outbound HTTPS requests to the Discovery Tree server: a heartbeat every
|
|
56
186
|
15 seconds, a long poll for commands, and posts of session events. Nothing listens on a port.
|
|
@@ -106,7 +236,72 @@ readable only by you (mode 0600) because it holds the runner token. `login` writ
|
|
|
106
236
|
| `idleTimeoutMinutes` | `15` | An idle Claude Code process is ended after this long; the next message resumes it. |
|
|
107
237
|
|
|
108
238
|
Environment variables: `DT_SERVER_URL` (server), `DT_RUNNER_TOKEN` (token; overrides the file),
|
|
109
|
-
`
|
|
239
|
+
`DT_PERSONAL_TOKEN` (personal API token for Discovery Tree MCP, `dtp_…`; overrides the file),
|
|
240
|
+
`DT_SERVICE_TOKEN` (optional team automation token when no personal token is set),
|
|
241
|
+
`DT_MCP_URL` (MCP endpoint; default `<server>/api/mcp`),
|
|
242
|
+
`DT_RUNNER_CLAUDE_BIN` (the `claude` binary to run). The full list, including these, the Codex
|
|
243
|
+
and Cursor binaries, API keys, and the XDG path variables, is under
|
|
244
|
+
[Prerequisites](#prerequisites). None of them are required to install.
|
|
245
|
+
|
|
246
|
+
### Discovery Tree API (local planning)
|
|
247
|
+
|
|
248
|
+
Local agents that run plans against Discovery Tree over MCP need a **personal API token**
|
|
249
|
+
(`dtp_…`), not the runner token. Create one under **Account settings → Connect your own Claude**.
|
|
250
|
+
You can save it in the same config file as `personalToken`, or set `DT_PERSONAL_TOKEN` for
|
|
251
|
+
scripts. For shared automation (CI or team docs), use `serviceToken` in the file or
|
|
252
|
+
`DT_SERVICE_TOKEN` when no personal token is set.
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"server": "https://discovery-tree-backend.onrender.com",
|
|
257
|
+
"personalToken": "dtp_…",
|
|
258
|
+
"serviceToken": "dtp_…",
|
|
259
|
+
"mcpUrl": "https://discovery-tree-backend.onrender.com/api/mcp"
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`personalToken` wins over `serviceToken`. Tokens must start with `dtp_` or `dto_` (OAuth
|
|
264
|
+
connectors). `mcpUrl` is optional; when omitted, the endpoint is `<server>/api/mcp` (see
|
|
265
|
+
`mcpServerUrl` in `src/tree-api.ts`).
|
|
266
|
+
|
|
267
|
+
Check connectivity (no runner pairing required — only the API token):
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
dt-runner api check
|
|
271
|
+
# or, before install:
|
|
272
|
+
npx @discovery-tree/runner api check
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The call uses the Streamable HTTP MCP endpoint (`list_trees`). To wire Claude Code, write an
|
|
276
|
+
MCP config with `writeClaudeMcpConfig` from the package source, or match:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
claude mcp add --transport http discovery-tree "$DT_MCP_URL" \
|
|
280
|
+
--header "Authorization: Bearer $DT_PERSONAL_TOKEN"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
(`DT_MCP_URL` defaults to `<server>/api/mcp` from `DT_SERVER_URL` or config `server`.)
|
|
284
|
+
|
|
285
|
+
#### One local plan step (MCP lifecycle)
|
|
286
|
+
|
|
287
|
+
Board automation in this repository talks to Discovery Tree over MCP using the modules in
|
|
288
|
+
`src/tree-api.ts` and `src/task-lifecycle.ts` (not re-exported from the published npm bundle;
|
|
289
|
+
import them from a clone when you build a local plan runner).
|
|
290
|
+
|
|
291
|
+
1. Resolve credentials after `resolveConfig` — `treeApiFromResolved(config)` reads
|
|
292
|
+
`DT_PERSONAL_TOKEN` / `DT_SERVICE_TOKEN` and the file fields above.
|
|
293
|
+
2. `connectTreeMcp(creds)` opens Streamable HTTP; `taskLifecycleFromConnection(conn)` returns a
|
|
294
|
+
`TreeTaskLifecycleClient` that wraps MCP calls with retries.
|
|
295
|
+
3. Per task: `claimTask` → `postProgress` (notes, questions, blockers) → `completeTask` (summary
|
|
296
|
+
and optional `pullRequestUrl`). `complete_task` with `heldUntilAccepted` keeps the claim until
|
|
297
|
+
review accepts the pull request.
|
|
298
|
+
4. On failure, `parseLocalTaskBrief(taskDescription)` reads the task text. Only a dedicated line
|
|
299
|
+
such as `release on failure` or `release on failure: yes` opts in (incidental mentions in
|
|
300
|
+
Verify prose do not). `failStep` then calls `release_task` or posts a `blocker`, matching that
|
|
301
|
+
choice.
|
|
302
|
+
|
|
303
|
+
Reproduce the lifecycle exercise with
|
|
304
|
+
`pnpm --filter @discovery-tree/runner test task-lifecycle`.
|
|
110
305
|
|
|
111
306
|
### Permissions and safety
|
|
112
307
|
|
|
@@ -488,24 +683,35 @@ worktree.
|
|
|
488
683
|
|
|
489
684
|
## Development
|
|
490
685
|
|
|
686
|
+
Install from a clone first ([Prerequisites](#prerequisites)): Node.js 22 or newer, pnpm
|
|
687
|
+
10.20.0, then `pnpm install --frozen-lockfile` at the repository root.
|
|
688
|
+
|
|
491
689
|
```bash
|
|
492
690
|
pnpm --filter @discovery-tree/runner test # vitest: mapper fixtures, fake-claude integration, fake server
|
|
691
|
+
pnpm --filter @discovery-tree/runner test cli # CLI parsing and exit codes (no subprocess)
|
|
692
|
+
pnpm --filter @discovery-tree/runner test task-lifecycle
|
|
693
|
+
pnpm --filter @discovery-tree/runner test install-smoke
|
|
493
694
|
pnpm --filter @discovery-tree/runner lint
|
|
494
695
|
pnpm --filter @discovery-tree/runner typecheck
|
|
495
696
|
pnpm --filter @discovery-tree/runner build # → dist/cli.js (single file, no runtime dependencies)
|
|
496
697
|
node packages/runner/dist/cli.js --help
|
|
497
698
|
```
|
|
498
699
|
|
|
499
|
-
The protocol is defined in `packages/contracts/src/agent-runner.ts`.
|
|
700
|
+
The protocol is defined in `packages/contracts/src/agent-runner.ts`. Discovery Tree MCP helpers
|
|
701
|
+
live in `src/tree-api.ts` (`connectTreeMcp`, `writeClaudeMcpConfig`) and
|
|
702
|
+
`src/task-lifecycle.ts` (`TreeTaskLifecycleClient`, `taskLifecycleFromConnection`); task-brief
|
|
703
|
+
directives are in `src/task-brief.ts` (`parseLocalTaskBrief`). `test/fixtures` holds real
|
|
500
704
|
Claude Code 2.1.296 `stream-json` output; `test/fake-claude.mjs` is a scripted stand-in for the CLI
|
|
501
|
-
used by the integration tests.
|
|
705
|
+
used by the integration tests. README sections for [install prerequisites](#prerequisites),
|
|
706
|
+
[exit codes](#exit-codes), and local planning are guarded by `test/readme-*.test.ts`.
|
|
502
707
|
|
|
503
708
|
## Releasing
|
|
504
709
|
|
|
505
710
|
`@discovery-tree/runner` is published to npm by the **Publish dt-runner** GitHub Actions
|
|
506
711
|
workflow (`.github/workflows/publish-runner.yml`), never from a laptop.
|
|
507
712
|
|
|
508
|
-
1.
|
|
713
|
+
1. Add release notes for the version in `packages/runner/CHANGELOG.md` and bump `version` in
|
|
714
|
+
`packages/runner/package.json` in a pull request, then merge it to `main`.
|
|
509
715
|
2. Actions → **Publish dt-runner** → **Run workflow** on `main`. It refuses a version that is
|
|
510
716
|
already on npm, runs lint, typecheck, tests and the build, then publishes publicly.
|
|
511
717
|
|
|
@@ -532,3 +738,14 @@ so the first release uses a token:
|
|
|
532
738
|
"Publishing access" to require 2FA and disallow tokens.
|
|
533
739
|
|
|
534
740
|
The repository is private, so npm does not attach provenance to the package.
|
|
741
|
+
|
|
742
|
+
## Embedding (desktop app)
|
|
743
|
+
|
|
744
|
+
The Discovery Tree desktop app runs the same runner code through `dist/embed.js`, without a
|
|
745
|
+
terminal. It exports `runRunnerHost(channel, opts)`: the app sends `RunnerHostCommand`
|
|
746
|
+
messages (`start`, `stop`, `status`, `pair`, `cancel_pairing`) and gets a reply with each
|
|
747
|
+
command's `id`, plus `status`, `log`, `pairing_started` and `pairing_outcome` events (the
|
|
748
|
+
types are in `@discovery-tree/contracts`). Loaded in an Electron utility process it wires
|
|
749
|
+
itself to `process.parentPort`; anywhere else, importing it does nothing. It takes the same
|
|
750
|
+
per-computer lock as `dt-runner start`, so a runner already running in a terminal shows up as
|
|
751
|
+
`held_elsewhere`. The CLI is unchanged.
|