@thedevlabs-io/labd 0.6.1 → 0.8.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 +23 -8
- package/README.md +38 -11
- package/dist/labd.js +1948 -1313
- package/dist/labd.js.map +4 -4
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -123,18 +123,23 @@ no one to show a diff to.
|
|
|
123
123
|
prompt. A setting that governs how much we check the model's work is exactly the
|
|
124
124
|
lever an instruction smuggled into a file would reach for. `e2e.test.ts` asserts
|
|
125
125
|
it never appears on the wire.
|
|
126
|
-
- **A project cannot set the mode.** `.labd/settings.json` may set a timeout
|
|
127
|
-
|
|
126
|
+
- **A project cannot set the mode.** `.labd/settings.json` may set a timeout;
|
|
127
|
+
`mode` is read from the GLOBAL settings and the command line only.
|
|
128
128
|
A repository that could set `mode: "agent"` would be a repository that runs
|
|
129
129
|
commands on the machine of anyone who clones it and types `labd`. See
|
|
130
130
|
`config.ts`, and the test that pins it.
|
|
131
131
|
- **A project cannot load its own code until trusted.** `.labd/extensions` needs
|
|
132
132
|
`labd trust` first. `git clone && labd` must not run a stranger's extension.
|
|
133
|
-
- **A project cannot redirect the token
|
|
134
|
-
|
|
135
|
-
ignored and the banner says so. The bearer token goes
|
|
136
|
-
so a checked-in URL is a checked-in token
|
|
137
|
-
|
|
133
|
+
- **A project cannot redirect the token, turn checkpoints off or raise the
|
|
134
|
+
effort, trusted or not.** `serverUrl`, `checkpoints` and `effort` in
|
|
135
|
+
`.labd/settings.json` are ignored and the banner says so. The bearer token goes
|
|
136
|
+
wherever that URL points, so a checked-in URL is a checked-in token
|
|
137
|
+
exfiltration for anyone who types `labd`; `checkpoints: false` takes away
|
|
138
|
+
`/undo`; `effort: high` spends the learner's allowance faster. `labd trust`
|
|
139
|
+
only lets the project's extensions run. That is a policy line rather than a
|
|
140
|
+
wall (a trusted extension runs in-process and could read `~/.labd` itself),
|
|
141
|
+
but it keeps a settings file from doing any of this silently. The VS Code
|
|
142
|
+
extension holds the same rule for its settings.
|
|
138
143
|
- **Extensions add commands and observers, never tools.** The tool list is the
|
|
139
144
|
protocol's: the server offers the model exactly the capabilities this client
|
|
140
145
|
declares, from one schema both surfaces share. A `registerTool` here would have
|
|
@@ -200,6 +205,14 @@ for the screen:
|
|
|
200
205
|
`Screen` owns the terminal; `modes/screen.ts` is the state machine between them.
|
|
201
206
|
- **The mouse is taken by default, for wheel scrolling, and `--no-mouse` gives
|
|
202
207
|
it back** - native text selection needs the terminal to have it.
|
|
208
|
+
- **Out of allowance, the box takes commands only.** At 0% a letter typed on an
|
|
209
|
+
empty box is dropped, which is what frees `o` to open the top-up page. `o` is
|
|
210
|
+
never taken while the learner can type: once the box holds a `/`, every key
|
|
211
|
+
types. A dropped letter asks the server again (at most every 10 s), and a
|
|
212
|
+
timer asks just after `resetsAt`, so a reset spent on the portal or the turn
|
|
213
|
+
of the month never leaves the box stuck. A refusal locks the box whatever the
|
|
214
|
+
clock says, until the next reading from the server. The browser is opened only for a URL `safeTopUpUrl` allows
|
|
215
|
+
(`packages/cli/src/browser.ts`).
|
|
203
216
|
|
|
204
217
|
**The non-interactive modes own nothing and print.** `labd -p`, `--json`,
|
|
205
218
|
`--mode rpc`, and anything with a piped stdout use `Renderer` and plain writes:
|
|
@@ -208,6 +221,8 @@ for the screen:
|
|
|
208
221
|
region is a no-op. Escape codes in a log file are worse than plain text.
|
|
209
222
|
- **The scrollback is not ours.** Finished output is printed and belongs to the
|
|
210
223
|
terminal; only the status line is a live region.
|
|
224
|
+
- **The exit code means something.** `labd -p` exits 0 answered, 1 failed, 2
|
|
225
|
+
needed an approval nobody could give, 3 this month's allowance is spent.
|
|
211
226
|
- **stdout is the answer. Everything else is stderr.** A pipeline must receive
|
|
212
227
|
only what labd meant as the answer. The interactive session keeps this for
|
|
213
228
|
what it prints on the way out - the "session saved" line goes to stderr.
|
|
@@ -307,7 +322,7 @@ properties that would fail silently:
|
|
|
307
322
|
- **containment** (`paths.test.ts`): traversal, absolute paths, symlinks out of the
|
|
308
323
|
tree, decorated paths. Every path labd touches is model output.
|
|
309
324
|
- **the permission properties** (`permissions.test.ts`): a project cannot set the
|
|
310
|
-
mode
|
|
325
|
+
mode, the server URL, checkpoints or effort, an untrusted project cannot load code, an extension
|
|
311
326
|
cannot shadow a built-in command, `agent` does not widen the denylist.
|
|
312
327
|
- **the session tree** (`session.test.ts`): branching, non-destructive compaction,
|
|
313
328
|
a truncated last line.
|
package/README.md
CHANGED
|
@@ -74,9 +74,17 @@ labd -c # pick up the most recent session here
|
|
|
74
74
|
| `--plain` | the older print-style session (deprecated; removed in 0.5) |
|
|
75
75
|
| `-v`, `--version` | |
|
|
76
76
|
|
|
77
|
+
`labd -p` exits with a code a script can act on:
|
|
78
|
+
|
|
79
|
+
| code | |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `0` | answered |
|
|
82
|
+
| `1` | failed |
|
|
83
|
+
| `2` | a change needed approval, and nobody was there to give it |
|
|
84
|
+
| `3` | this month's labd allowance is spent; the server's message, with the top-up link, is on stderr |
|
|
85
|
+
|
|
77
86
|
Subcommands: `login`, `logout` (revokes the token server-side too), `sessions`
|
|
78
|
-
(earlier sessions here), `trust` (let this project load its own extensions
|
|
79
|
-
name its own server).
|
|
87
|
+
(earlier sessions here), `trust` (let this project load its own extensions).
|
|
80
88
|
|
|
81
89
|
### Inside a session
|
|
82
90
|
|
|
@@ -129,11 +137,29 @@ more columns.
|
|
|
129
137
|
| `/sessions`, `/session` | earlier sessions here (a dialog; `enter` resumes); where this one is stored |
|
|
130
138
|
| `/new` | start a fresh session; the current one stays saved |
|
|
131
139
|
| `/sidebar`, `/clear` | show or hide the side panel; clear the screen |
|
|
132
|
-
| `/usage` | what's left of this month's allowance |
|
|
140
|
+
| `/usage` | what's left of this month's allowance, when it resets, any saved resets, the top-up link, and a heatmap of your activity |
|
|
141
|
+
| `/topup` | open the page to top up or use a saved reset, in your browser |
|
|
133
142
|
| `/trust` | let this project load its own extensions |
|
|
134
143
|
| `/reload` | reload extensions and the file list |
|
|
135
144
|
| `/quit` | leave - the session is saved, and `labd --resume <id>` continues it |
|
|
136
145
|
|
|
146
|
+
### Running low, and running out
|
|
147
|
+
|
|
148
|
+
The footer shows what is left of this month's allowance. At 15% or less it
|
|
149
|
+
turns yellow and reads `10% left · /topup`; at 0 it turns red and reads
|
|
150
|
+
`out of labd · /topup`, and the box takes commands only. Type `/` for
|
|
151
|
+
one, or press `o` on the empty box to open the top-up page in your browser. A
|
|
152
|
+
question refused for a spent allowance gets a card with the server's message,
|
|
153
|
+
the day it resets, any resets you have saved, and the link. Once you have
|
|
154
|
+
topped up or spent a reset, type anything and labd checks again (at most every
|
|
155
|
+
10 seconds). What you type then is not kept; only the check is. The box also
|
|
156
|
+
opens by itself when the month turns.
|
|
157
|
+
|
|
158
|
+
Saved resets are spent on the portal, not in the terminal: `/topup` and `o`
|
|
159
|
+
only open the page. labd opens a browser only for its own portal's
|
|
160
|
+
`/settings/labd` page, and prints the link to open by hand if it cannot start
|
|
161
|
+
one.
|
|
162
|
+
|
|
137
163
|
When you leave, the conversation is handed to the server to be distilled into
|
|
138
164
|
memory, exactly as the editor does when you start a new chat - which is what
|
|
139
165
|
makes "same memory" true in the terminal. Tool results are stripped before it
|
|
@@ -167,9 +193,11 @@ Two more rules worth knowing before you point this at a repository you didn't wr
|
|
|
167
193
|
repo and typing `labd` would be running whatever it decided to allow itself.
|
|
168
194
|
- **A project can't load its own code until you say so.** `.labd/extensions` needs
|
|
169
195
|
`labd trust` in that directory first.
|
|
170
|
-
- **A project can't point your token at another server
|
|
171
|
-
|
|
172
|
-
the
|
|
196
|
+
- **A project can't point your token at another server, turn checkpoints off,
|
|
197
|
+
or raise the effort.** A `serverUrl`, `checkpoints` or `effort` in
|
|
198
|
+
`.labd/settings.json` is ignored, and the banner says so. Set them in
|
|
199
|
+
`~/.labd/settings.json` (or `LABD_SERVER_URL` for the server, `--think` for the effort). `labd trust`
|
|
200
|
+
does not change this.
|
|
173
201
|
|
|
174
202
|
## Files it keeps
|
|
175
203
|
|
|
@@ -183,10 +211,9 @@ Two more rules worth knowing before you point this at a repository you didn't wr
|
|
|
183
211
|
| `.labd/extensions/` | per-project extensions, loaded once trusted |
|
|
184
212
|
|
|
185
213
|
`settings.json` keys, global or per project: `timeout` as `commandTimeoutSeconds`
|
|
186
|
-
(5
|
|
187
|
-
`
|
|
188
|
-
(`
|
|
189
|
-
is trusted. `mode` is read from the global file only.
|
|
214
|
+
(5 to 600), `mouse` (`true`; the full-screen session takes the mouse for
|
|
215
|
+
scrolling) and `sidebar` (`false`). Global file only: `mode`, `serverUrl`,
|
|
216
|
+
`checkpoints` (`true` by default) and `effort` (`low`/`medium`/`high`).
|
|
190
217
|
|
|
191
218
|
`LABD_HOME`, `LABD_SERVER_URL`, and `LABD_TOKEN` override the corresponding thing;
|
|
192
219
|
the last is how you run labd in CI without pairing. `NO_COLOR` turns colour off,
|
|
@@ -227,7 +254,7 @@ The protocol is small:
|
|
|
227
254
|
| `labd/capabilities` | mode, root, methods |
|
|
228
255
|
| labd sends | |
|
|
229
256
|
| `labd/ready` | first, on start: protocol, framing, session id, mode, root |
|
|
230
|
-
| `labd/text`, `labd/status`, `labd/done`, `labd/error` | notifications as the turn runs |
|
|
257
|
+
| `labd/text`, `labd/status`, `labd/done`, `labd/error` | notifications as the turn runs; `labd/error` carries `code` when the server gave one, and `credits` with `no_credits` |
|
|
231
258
|
| `labd/tool` `{name, status, input, detail, preview, output, helper?}` | each tool step; `preview` is the diff or the command, `output` what came back, `helper` `{id, label}` when a helper made the call |
|
|
232
259
|
| `labd/command_output` `{line, key?}` | a running command's own output, as it happens; `key` names a helper's call |
|
|
233
260
|
| `labd/approve` `{call, preview, helper?}` | **a request to you** - answer `{approved: true\|false}`; `helper` names the helper asking |
|