@thedevlabs-io/labd 0.3.1 → 0.5.0
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/AGENTS.md +54 -18
- package/README.md +76 -66
- package/dist/labd.js +2098 -213
- package/dist/labd.js.map +4 -4
- package/package.json +1 -3
package/AGENTS.md
CHANGED
|
@@ -35,7 +35,7 @@ executes tools.
|
|
|
35
35
|
|
|
36
36
|
```
|
|
37
37
|
packages/core/ the agent loop, tools, permission checks, sessions, checkpoints
|
|
38
|
-
packages/tui/ terminal rendering - differential redraw, markdown, cards
|
|
38
|
+
packages/tui/ terminal rendering - the full screen, differential redraw, markdown, cards
|
|
39
39
|
packages/cli/ the binary: config, auth, extensions, and the four run modes
|
|
40
40
|
vendor/labd/ submodule - the labd repo, for @labd/protocol
|
|
41
41
|
test/ vitest; `e2e.test.ts` runs the built binary against a fake server
|
|
@@ -176,34 +176,70 @@ Do not "simplify" this into a list. The list version cannot do any of the three.
|
|
|
176
176
|
|
|
177
177
|
## Terminal rules
|
|
178
178
|
|
|
179
|
+
Two kinds of program live in this repo, and the rules differ by which one you are in.
|
|
180
|
+
|
|
181
|
+
**The interactive session owns the screen.** `labd` on its own runs
|
|
182
|
+
`modes/screen.ts`: the alternate screen buffer, a scrollable transcript, a
|
|
183
|
+
multi-line composer, popups for `/` and `@`, dialogs for lists, approvals inline.
|
|
184
|
+
This replaced the "print into the scrollback, keep one live box at the bottom"
|
|
185
|
+
model in 0.4.0. That model was principled - the terminal owned the transcript, so
|
|
186
|
+
search and copy came free - and learners did not want it: they wanted an app, not
|
|
187
|
+
a log. `--plain` still runs the old loop for one release and is deprecated. Rules
|
|
188
|
+
for the screen:
|
|
189
|
+
|
|
190
|
+
- **Full-screen only when stdin AND stdout are TTYs.** Anything else falls
|
|
191
|
+
through to the printing modes below; a learner must never type blind.
|
|
192
|
+
- **Give the terminal back, whatever happens.** `Screen.leave` runs from the
|
|
193
|
+
normal exit, the `finally`, the signal handlers and the process `exit` hook, in
|
|
194
|
+
the reverse order of `enter`, and is idempotent. Raw mode or the alternate
|
|
195
|
+
screen left on looks like a broken machine.
|
|
196
|
+
- **Frames are whole and drawn differentially with absolute positions.** No
|
|
197
|
+
relative cursor moves: there is no scrollback to keep in step with.
|
|
198
|
+
- **Pure logic is separate from I/O.** `keys`, `layout`, `transcript`, `editor`,
|
|
199
|
+
`popup`, `dialog` know nothing about a stream and are tested without one.
|
|
200
|
+
`Screen` owns the terminal; `modes/screen.ts` is the state machine between them.
|
|
201
|
+
- **The mouse is taken by default, for wheel scrolling, and `--no-mouse` gives
|
|
202
|
+
it back** - native text selection needs the terminal to have it.
|
|
203
|
+
|
|
204
|
+
**The non-interactive modes own nothing and print.** `labd -p`, `--json`,
|
|
205
|
+
`--mode rpc`, and anything with a piped stdout use `Renderer` and plain writes:
|
|
206
|
+
|
|
179
207
|
- **Never assume a TTY.** Piped, redirected, or in CI, colour is off and the live
|
|
180
208
|
region is a no-op. Escape codes in a log file are worse than plain text.
|
|
181
209
|
- **The scrollback is not ours.** Finished output is printed and belongs to the
|
|
182
|
-
terminal; only the status line is a live region.
|
|
183
|
-
selection, and copy-paste working.
|
|
210
|
+
terminal; only the status line is a live region.
|
|
184
211
|
- **stdout is the answer. Everything else is stderr.** A pipeline must receive
|
|
185
|
-
only what labd meant as the answer.
|
|
212
|
+
only what labd meant as the answer. The interactive session keeps this for
|
|
213
|
+
what it prints on the way out - the "session saved" line goes to stderr.
|
|
214
|
+
|
|
215
|
+
**Everywhere:**
|
|
216
|
+
|
|
186
217
|
- **Escape sequences are written as `\u001b` escapes**, never as literal bytes, so
|
|
187
218
|
source files stay greppable ASCII.
|
|
219
|
+
- **Zero runtime dependencies.** No ink, no blessed, no opentui: the TUI is the
|
|
220
|
+
repo's own `Screen` and differential drawing, so the bundle stays one file and
|
|
221
|
+
still works as a Node single-executable.
|
|
188
222
|
|
|
189
223
|
## Distribution
|
|
190
224
|
|
|
191
|
-
|
|
225
|
+
**The GitHub organisation is private, and public docs must not link to it.**
|
|
226
|
+
Learners cannot reach `github.com/thedevlabs-io/*`, raw.githubusercontent.com,
|
|
227
|
+
or GitHub Release assets. The public channels are npm (`@thedevlabs-io/labd`, bin
|
|
228
|
+
`labd`) and the VS Code Marketplace (`thedevlabs-io.labd`); README.md and every
|
|
229
|
+
user-facing string point at those and nowhere else. This file is for
|
|
230
|
+
contributors with access, so it may name the repositories.
|
|
231
|
+
|
|
232
|
+
Two bundles, one source, one channel:
|
|
192
233
|
|
|
193
234
|
- **`dist/labd.js`** - ESM, zero runtime dependencies, what npm's `bin` points at.
|
|
194
|
-
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
macOS needs the signing dance in `build-binaries.mjs`, and it is not optional -
|
|
203
|
-
injecting invalidates the signature, and macOS kills an invalidly-signed binary
|
|
204
|
-
rather than running it. The build also RUNS the binary before calling it done,
|
|
205
|
-
because every one of those steps fails by producing something that does not start
|
|
206
|
-
rather than by erroring.
|
|
235
|
+
`npm install -g @thedevlabs-io/labd` is the install; `npm update -g` the upgrade.
|
|
236
|
+
- **`dist/labd.cjs`** - the same code as CommonJS. Kept because Node's
|
|
237
|
+
single-executable support runs its entry as CJS and refuses an ESM one, so a
|
|
238
|
+
standalone build stays possible without a code change. This is why `bin/labd.ts`
|
|
239
|
+
must never use top-level await; CI runs the CJS bundle to prove it loads.
|
|
240
|
+
|
|
241
|
+
Standalone binaries, the install scripts and the GitHub Release step were removed
|
|
242
|
+
in 0.4.0: they were only reachable through GitHub, which learners cannot see.
|
|
207
243
|
|
|
208
244
|
`npm install -g git+ssh://...` cannot work: `dist/` is not committed and npm does
|
|
209
245
|
not fetch submodules for a git dependency. `scripts/prepare.mjs` says so rather
|
package/README.md
CHANGED
|
@@ -3,80 +3,49 @@
|
|
|
3
3
|
labd in your terminal — the Dev Labs assistant, in the project you're standing in.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
[o_o] labd · labd-cli develop · session 3f9a12c0 auto
|
|
7
|
+
─────────────────────────────────────────────────────────────────────────────────
|
|
8
|
+
> why is session.test.ts failing?
|
|
9
|
+
|
|
10
|
+
● Read test/session.test.ts
|
|
11
|
+
? Run a command
|
|
12
|
+
to see which of the eleven cases fails
|
|
13
|
+
|
|
14
|
+
npx vitest run test/session.test.ts
|
|
15
|
+
|
|
16
|
+
On auto, commands still ask - a command can do anything your shell can, and
|
|
17
|
+
put back isn't one of them.
|
|
18
|
+
y to allow · n or esc to decline
|
|
19
|
+
╭───────────────────────────────────────────────────────────────────────────────╮
|
|
20
|
+
│ > ask labd something - / for commands - @ to tag a file │
|
|
21
|
+
╰───────────────────────────────────────────────────────────────────────────────╯
|
|
22
|
+
y allow · n decline · ctrl+c stop context 12% · credits 82%
|
|
20
23
|
```
|
|
21
24
|
|
|
22
|
-
This is the same assistant as the
|
|
23
|
-
and the one docked in the learning portal
|
|
24
|
-
|
|
25
|
+
This is the same assistant as the labd VS Code extension (Marketplace:
|
|
26
|
+
`thedevlabs-io.labd`) and the one docked in the learning portal at
|
|
27
|
+
[learn.thedevlabs.io](https://learn.thedevlabs.io) — same server, same prompt,
|
|
28
|
+
same memory, same permission model. Ask something in your editor, follow up in
|
|
29
|
+
your terminal.
|
|
25
30
|
|
|
26
31
|
## Install
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
curl -fsSL https://raw.githubusercontent.com/thedevlabs-io/labd-cli/production/install.sh | sh
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
**Windows** — same, in PowerShell:
|
|
35
|
-
|
|
36
|
-
```powershell
|
|
37
|
-
irm https://raw.githubusercontent.com/thedevlabs-io/labd-cli/production/install.ps1 | iex
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**With npm**, if you already have Node 22+:
|
|
33
|
+
You need Node 22 or newer. Then:
|
|
41
34
|
|
|
42
35
|
```bash
|
|
43
36
|
npm install -g @thedevlabs-io/labd
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Then connect:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
37
|
labd login # approve a short code in your browser
|
|
50
38
|
```
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
<summary>Other ways, and what each is for</summary>
|
|
54
|
-
|
|
55
|
-
| how | when |
|
|
56
|
-
|---|---|
|
|
57
|
-
| `install.sh` / `install.ps1` | a machine with nothing on it. Downloads a ~40 MB archive containing a single executable with the Node runtime inside it. |
|
|
58
|
-
| `npm install -g @thedevlabs-io/labd` | you have Node. Smaller download, and `npm update -g @thedevlabs-io/labd` upgrades it. |
|
|
59
|
-
| `npm pack` → share the `.tgz` | an air-gapped machine, or pinning an exact build. `npm install -g thedevlabs-io-labd-0.3.1.tgz`. |
|
|
60
|
-
| copy `dist/labd.js` | you built from source. It has **zero runtime dependencies**, so that one file plus Node 22+ is a working install anywhere. |
|
|
61
|
-
| clone + `npm link` | working on labd itself. |
|
|
62
|
-
|
|
63
|
-
`npm install -g git+ssh://…` does **not** work, and says so rather than half-installing: `dist/` is not committed, and npm does not fetch the git submodule that the build needs.
|
|
64
|
-
|
|
65
|
-
While this repository is private, the install scripts need a credential to read release assets. They use the GitHub CLI when it is signed in, or `GH_TOKEN` if you set one, and explain that rather than failing with a 404.
|
|
66
|
-
|
|
67
|
-
**Building from source:**
|
|
40
|
+
To upgrade:
|
|
68
41
|
|
|
69
42
|
```bash
|
|
70
|
-
|
|
71
|
-
cd labd-cli
|
|
72
|
-
git submodule update --init # the protocol lives in the labd repo
|
|
73
|
-
npm install
|
|
74
|
-
npm run build # dist/labd.js (and dist/labd.cjs, for binaries)
|
|
75
|
-
npm link # puts `labd` on your PATH
|
|
76
|
-
npm run build:binary # optional: a standalone executable for this platform
|
|
43
|
+
npm update -g @thedevlabs-io/labd
|
|
77
44
|
```
|
|
78
45
|
|
|
79
|
-
|
|
46
|
+
The package is one bundled file with zero runtime dependencies, so that is the
|
|
47
|
+
whole install. There are no standalone binaries and no `curl | sh` installer: npm
|
|
48
|
+
is the one public channel.
|
|
80
49
|
|
|
81
50
|
## Using it
|
|
82
51
|
|
|
@@ -101,14 +70,52 @@ labd -c # pick up the most recent session here
|
|
|
101
70
|
| `-e`, `--extension <path>` | load an extension file (repeatable; `/reload` keeps it) |
|
|
102
71
|
| `--no-extensions` | load none, now and on `/reload` |
|
|
103
72
|
| `--no-color` / `--color` | force colour off or on |
|
|
73
|
+
| `--no-mouse` | leave the mouse to the terminal, for native text selection |
|
|
74
|
+
| `--plain` | the older print-style session (deprecated; removed in 0.5) |
|
|
104
75
|
| `-v`, `--version` | |
|
|
105
76
|
|
|
106
77
|
Subcommands: `login`, `logout` (revokes the token server-side too), `sessions`
|
|
107
78
|
(earlier sessions here), `trust` (let this project load its own extensions and
|
|
108
79
|
name its own server).
|
|
109
80
|
|
|
110
|
-
Inside a session
|
|
111
|
-
|
|
81
|
+
### Inside a session
|
|
82
|
+
|
|
83
|
+
`labd` on its own opens a full-screen session: a header, a scrollable transcript,
|
|
84
|
+
a box to type in at the bottom, and a footer with the keys that apply right now
|
|
85
|
+
and how full the conversation is. The transcript follows the answer as it
|
|
86
|
+
streams; scroll up and it stops following and tells you how many lines have
|
|
87
|
+
arrived since (`End`, or scrolling back to the bottom, follows again).
|
|
88
|
+
|
|
89
|
+
| key | |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `enter` | send |
|
|
92
|
+
| `shift+enter`, `ctrl+j`, or a line ending in `\` | new line in the box (it grows to 8 rows) |
|
|
93
|
+
| `/` | a list of commands appears above the box; `↑↓` moves, `tab`/`enter` accepts, `esc` closes |
|
|
94
|
+
| `@` | the same, for files in the project — `@src/index.ts` tags the file into the question |
|
|
95
|
+
| `tab` | complete the command or path being typed |
|
|
96
|
+
| `pgup` / `pgdn`, mouse wheel | scroll the transcript |
|
|
97
|
+
| `home` / `end` | top / bottom of the transcript (with an empty box; otherwise they move within the line) |
|
|
98
|
+
| `↑` / `↓` | earlier questions, when the caret is on the first / last line |
|
|
99
|
+
| `esc` | close a list or dialog; otherwise jump back to the bottom |
|
|
100
|
+
| `y` / `n` | answer an approval card. Nothing else answers it, and `enter` never does |
|
|
101
|
+
| `ctrl+c` | stop the answer; else clear the box; else press it again within 2 s to quit |
|
|
102
|
+
| `ctrl+d` | quit |
|
|
103
|
+
| `ctrl+n`, `ctrl+o` | new session, earlier sessions |
|
|
104
|
+
| `ctrl+l` | redraw |
|
|
105
|
+
|
|
106
|
+
`/help`, `/sessions` and `/tree` open a dialog you can type into to narrow the
|
|
107
|
+
list; `enter` picks — a session to resume, or a point in this session to continue
|
|
108
|
+
from. Approvals are never dialogs: the card is drawn inline in the transcript
|
|
109
|
+
with its context, and `y` is the only key that allows it.
|
|
110
|
+
|
|
111
|
+
Two flags for the screen. `--no-mouse` leaves the mouse to the terminal (the
|
|
112
|
+
session takes it for wheel scrolling, and native text selection needs it
|
|
113
|
+
released); `mouse: false` in a settings file does the same. `--plain` runs the
|
|
114
|
+
older print-style session, where answers land in the terminal's scrollback and
|
|
115
|
+
only the box is redrawn — kept for one release for terminals that cannot cope
|
|
116
|
+
with the alternate screen, and deprecated. `sidebar: true`, or `/sidebar`, adds
|
|
117
|
+
a panel with the project, branch, mode and recent steps when there are 120 or
|
|
118
|
+
more columns.
|
|
112
119
|
|
|
113
120
|
| command | |
|
|
114
121
|
|---|---|
|
|
@@ -118,7 +125,9 @@ and `/commands`, ctrl-c stops an answer without leaving.
|
|
|
118
125
|
| `/redo` | reapply what `/undo` put back |
|
|
119
126
|
| `/tree` | every point in this session; branch from any of them |
|
|
120
127
|
| `/resume <id>` | continue from a point in `/tree` |
|
|
121
|
-
| `/sessions`, `/session` | earlier sessions here; where this one is stored |
|
|
128
|
+
| `/sessions`, `/session` | earlier sessions here (a dialog; `enter` resumes); where this one is stored |
|
|
129
|
+
| `/new` | start a fresh session; the current one stays saved |
|
|
130
|
+
| `/sidebar`, `/clear` | show or hide the side panel; clear the screen |
|
|
122
131
|
| `/usage` | what's left of this month's allowance |
|
|
123
132
|
| `/trust` | let this project load its own extensions |
|
|
124
133
|
| `/reload` | reload extensions and the file list |
|
|
@@ -173,9 +182,10 @@ Two more rules worth knowing before you point this at a repository you didn't wr
|
|
|
173
182
|
| `.labd/extensions/` | per-project extensions, loaded once trusted |
|
|
174
183
|
|
|
175
184
|
`settings.json` keys, global or per project: `timeout` as `commandTimeoutSeconds`
|
|
176
|
-
(5–600), `effort` (`low`/`medium`/`high`), `checkpoints` (`true` by default),
|
|
177
|
-
`
|
|
178
|
-
`
|
|
185
|
+
(5–600), `effort` (`low`/`medium`/`high`), `checkpoints` (`true` by default),
|
|
186
|
+
`mouse` (`true`; the full-screen session takes the mouse for scrolling), `sidebar`
|
|
187
|
+
(`false`), and `serverUrl` — honoured from a project file only once that project
|
|
188
|
+
is trusted. `mode` is read from the global file only.
|
|
179
189
|
|
|
180
190
|
`LABD_HOME`, `LABD_SERVER_URL`, and `LABD_TOKEN` override the corresponding thing;
|
|
181
191
|
the last is how you run labd in CI without pairing. `NO_COLOR` turns colour off,
|
|
@@ -256,7 +266,7 @@ in `~/.labd/extensions`.
|
|
|
256
266
|
## Development
|
|
257
267
|
|
|
258
268
|
```bash
|
|
259
|
-
npm run build # bundle to dist/labd.js
|
|
269
|
+
npm run build # bundle to dist/labd.js (and dist/labd.cjs)
|
|
260
270
|
npm test # vitest (build first — the e2e suite spawns the binary)
|
|
261
271
|
npm run check # typecheck + tests
|
|
262
272
|
```
|