@rob-c/pi-managed-tools 0.16.0 → 0.23.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/BUSYBOX-CONTRACT.md +440 -0
- package/CHANGELOG.md +441 -0
- package/README.md +464 -35
- package/package.json +7 -4
- package/skills/busybox-applets/SKILL.md +142 -15
- package/skills/managed-tools/SKILL.md +201 -25
- package/skills/managed-tools-reference/SKILL.md +206 -38
- package/src/agentops.ts +813 -0
- package/src/agenttools.ts +391 -0
- package/src/bashtool.ts +103 -0
- package/src/build.ts +142 -0
- package/src/context.ts +157 -0
- package/src/display.ts +79 -0
- package/src/extension.ts +817 -28
- package/src/guard.ts +437 -0
- package/src/jobs.ts +1052 -0
- package/src/timing.ts +364 -0
- package/src/tools.ts +525 -42
- package/src/userstdin.ts +524 -0
- package/src/wrap.ts +683 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,446 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.23.0]
|
|
4
|
+
|
|
5
|
+
**A hardening pass: what the model is told is checked against the binary, commands that
|
|
6
|
+
escaped the wrapper no longer do, and a result says what it cannot show.** Each item was
|
|
7
|
+
found by examining a real session or measuring the installed build.
|
|
8
|
+
|
|
9
|
+
*False things the model was told*
|
|
10
|
+
|
|
11
|
+
- **The truncation pointer pointed at lines the model already had.** `run` keeps the head
|
|
12
|
+
*and* the tail of a long timeline; the hint still said "head only … read the end". It
|
|
13
|
+
now names the omitted range, the command that reads from it, and how many of the omitted
|
|
14
|
+
lines are on stderr (from `log --summary`).
|
|
15
|
+
- **The prompt quoted a stamp the binary no longer prints.** The example line is now cut
|
|
16
|
+
from a line the installed build really printed, at session start; every shape a build
|
|
17
|
+
has printed parses (one to nine fraction digits, padded or not).
|
|
18
|
+
- **`verbose` was 200 KB and pi keeps 50.** pi's bash tool keeps the last 2000 lines or
|
|
19
|
+
50 KB, so the model got the tail end of the view with its header cut off. `verbose` is
|
|
20
|
+
49 KB, and whenever pi's cut removes the `run=` header it is restored from the full
|
|
21
|
+
output pi kept, and the cut is said.
|
|
22
|
+
- **A capture could be deleted by another session.** One artifact root, one `--prune 20`,
|
|
23
|
+
every session on the machine. The wrapper no longer prunes; the sweep removes a run only
|
|
24
|
+
when it is beyond the newest 200 and more than two hours old.
|
|
25
|
+
|
|
26
|
+
*Commands that escaped the wrapper*
|
|
27
|
+
|
|
28
|
+
- **`busybox sh -c` is wrapped.** Any `busybox …` call counted as already wrapped, and the
|
|
29
|
+
guidelines recommend `busybox sh -c` for multi-step logic: those ran with no timeline,
|
|
30
|
+
no deadline and no silence watchdog. Only capture and record applets are left alone.
|
|
31
|
+
- **Flags are taken from the build's own feature list, and the build is run once at
|
|
32
|
+
session start.** `--stamp-ns` and `-W` were unconditional. A refused pseudo-terminal
|
|
33
|
+
now means plain pipes; a binary that fails its self-test turns the wrapper off with a
|
|
34
|
+
warning instead of failing every call.
|
|
35
|
+
- **`GRADLE_OPTS`, `MAVEN_ARGS`, `RUBYOPT` are appended to, not replaced.**
|
|
36
|
+
- **Buffering is switched off for more than Python and Ruby**: `STDBUF1=L` (every C-stdio
|
|
37
|
+
program on macOS), a Perl prelude, `LUA_INIT`, and an opt-in `stdbuf` preload for Linux.
|
|
38
|
+
|
|
39
|
+
*Deeper in pi*
|
|
40
|
+
|
|
41
|
+
- **Wrapping happens in the bash tool's `execute`**, not by rewriting the call in
|
|
42
|
+
`tool_call`: later extensions' hooks see what the model wrote.
|
|
43
|
+
- **The header travels as data** (`details.piTime`, and beside pi's own
|
|
44
|
+
`structuredContent`, which a content-only patch used to drop).
|
|
45
|
+
- **pi's own renderer draws the result** — collapsed preview, expand key, truncation
|
|
46
|
+
warning — on the command's own lines.
|
|
47
|
+
- **Old results lose their offsets at compaction**, when the prompt is rebuilt anyway.
|
|
48
|
+
- **A `!` command reaches the model as a timeline.**
|
|
49
|
+
- **`busybox_job`**: start a command that outlives the call, read its new output, wait for
|
|
50
|
+
a line, stop it.
|
|
51
|
+
- **Settings in pi's settings file** (`managedTools`), and `/managed-tools` switches kept
|
|
52
|
+
across a resume.
|
|
53
|
+
|
|
54
|
+
*Results that are harder to misread*
|
|
55
|
+
|
|
56
|
+
- **The outcome comes first** when it was not the command's own exit.
|
|
57
|
+
- **Facts instead of "unknown"**: each pipeline stage's status and the final directory,
|
|
58
|
+
left by the guest shell in its run folder; no note when there is nothing to say.
|
|
59
|
+
- **A repeated caveat is a few words**, not the same two lines every call.
|
|
60
|
+
- **An offset is printed once per burst** (`[= out]`); stamps were a quarter of all
|
|
61
|
+
bash-result bytes.
|
|
62
|
+
- **A command that cannot end is refused before it runs**, with the rewrite: a pager, an
|
|
63
|
+
editor, `tail -f`, `watch`, a foreground server.
|
|
64
|
+
|
|
65
|
+
*Tests*
|
|
66
|
+
|
|
67
|
+
- The testbench's `hardening` scenario checks each claim in the prompt against a real
|
|
68
|
+
run. `scripts/benchmark-pi.mjs` gained five negative-knowledge probes — questions whose
|
|
69
|
+
true answer is "the result does not say" — graded honest / fabricated / unclear
|
|
70
|
+
(`--only probes`; a bare run is unchanged). `tests/extension.test.ts` no longer waits
|
|
71
|
+
on a release check it cannot reach: 13 seconds instead of nearly five minutes.
|
|
72
|
+
|
|
73
|
+
**Standard input: a `!` command can be answered, and the model is told the truth about
|
|
74
|
+
its own.** Measured first, hop by hop: `busybox run` forwards its stdin to the guest in
|
|
75
|
+
every mode (pty or not) and ends it with end-of-file — but pi starts every command with
|
|
76
|
+
stdin closed and its backend has no stdin argument, so there was never anything to
|
|
77
|
+
forward. A `Proceed? [y/N]` prompt read end-of-file, took its default and exited 0.
|
|
78
|
+
|
|
79
|
+
- **`!` commands show their output as it arrives.** `busybox run -q` prints its capture
|
|
80
|
+
when the command *exits*, so a wrapped `!` command showed nothing until then — not even
|
|
81
|
+
the question it was asking. The run now gets a private artifact root (`--dir`) and its
|
|
82
|
+
capture files, which `run` writes as bytes arrive, are followed while it runs. (`--jsonl`
|
|
83
|
+
does not serve: it emits per *line*, so an unterminated prompt stays invisible.)
|
|
84
|
+
- **`!` commands can be answered.** The wrapper is given `--stdin <named pipe>`; when the
|
|
85
|
+
command looks like it is waiting (output stopped on an unfinished line for 0.4 s, or
|
|
86
|
+
3 s of silence) pi's input dialog opens and each submitted line is written to the pipe.
|
|
87
|
+
Esc in the dialog ends the input — the guest reads end-of-file — and returns the editor;
|
|
88
|
+
the command keeps running. pi's own backend still does the spawning, so process-group
|
|
89
|
+
killing, Esc and the environment are unchanged. What is typed is never added to the
|
|
90
|
+
output (the session records it and the model reads it).
|
|
91
|
+
- **A question waits five minutes for its answer, then the command is stopped.** Longer
|
|
92
|
+
than the 120s a model's command gets, on purpose: this bounds a person, not a program.
|
|
93
|
+
The clock runs only while the input dialog is open (pi draws the countdown in its
|
|
94
|
+
title), so a `!` command that is working still has no deadline. On expiry the command is
|
|
95
|
+
stopped — exit status 124 and a `[stopped: the command waited 5m for input …]` line in
|
|
96
|
+
its output, where the session records it — rather than given end-of-file, which a
|
|
97
|
+
`[Y/n]` prompt would take for yes. `PI_MANAGED_TOOLS_STDIN_TIMEOUT=<seconds>` changes
|
|
98
|
+
it; `0` removes it.
|
|
99
|
+
- **`busybox_run` takes `stdin`**: text fed to the command, then end-of-file.
|
|
100
|
+
- **The "stdin gets no EOF" claim is gone**, from the per-turn guidelines, the `IDLE`
|
|
101
|
+
notice (bash and `busybox_run`), the skill and the README. It was false: a model's
|
|
102
|
+
command reads end-of-file at once. The guideline now says so, and how to answer a prompt
|
|
103
|
+
from inside the command; the `IDLE` notice rules stdin out instead of blaming it.
|
|
104
|
+
- `PI_MANAGED_TOOLS_USER_STDIN=off` restores the previous `!` path (stdin empty, output at
|
|
105
|
+
exit, capture kept in the shared root). With no UI the new path still shows output live
|
|
106
|
+
and leaves stdin empty.
|
|
107
|
+
- The `pruned=N keep=20` line `run -q --prune` printed into a `!` command's output no
|
|
108
|
+
longer appears on the live path.
|
|
109
|
+
|
|
110
|
+
Costs: one `mkfifo` and one temporary folder per `!` command, removed when it ends, and no
|
|
111
|
+
`busybox log` re-read for those runs. A full-screen program is still out of reach.
|
|
112
|
+
|
|
113
|
+
## [0.22.0]
|
|
114
|
+
|
|
115
|
+
**Pi-Time: a default deadline for every wrapped command, and a timeout that says it is one.**
|
|
116
|
+
The timestamps ("Pi-Time" — the wrapper's name for conveying time itself to the model:
|
|
117
|
+
stream, offset, deadline) already carried which stream and when; this release adds the
|
|
118
|
+
third fact, how long is too long.
|
|
119
|
+
Without a deadline, a command that hangs — a loop, a server that never exits, a prompt
|
|
120
|
+
waiting on stdin — held the model until pi's harness gave up, and the result read like a
|
|
121
|
+
command failure: `exit_code=-1 timed_out=true` followed by pi's "Command exited with code 3",
|
|
122
|
+
which invites a debugging detour instead of a retry.
|
|
123
|
+
|
|
124
|
+
- **Every wrapped bash command now gets a 120s deadline by default.** A caller's own
|
|
125
|
+
`timeout` still wins (taken over one second earlier, as before); the default applies only
|
|
126
|
+
when nobody asked for one. `PI_MANAGED_TOOLS_TIMEOUT=<seconds>` changes it for a session,
|
|
127
|
+
and `PI_MANAGED_TOOLS_TIMEOUT=0` (or `off`) removes the deadline entirely.
|
|
128
|
+
- **A timeout result now opens with `TIMEOUT — not a failure of the command`.** The notice
|
|
129
|
+
explains that `exit_code=-1` and "Command exited with code 3" are the kill status, points
|
|
130
|
+
at `busybox log <run>` for the partial capture, and names the recovery moves: raise
|
|
131
|
+
`timeout` on the call, narrow the command, or background it and poll with `waitfor`.
|
|
132
|
+
A cancellation gets its own `CANCELLED` notice, distinct from a deadline.
|
|
133
|
+
- The `busybox_run` tool's own text got the same notices, and its default `timeout_s`
|
|
134
|
+
now shares the same constant (120) instead of a literal.
|
|
135
|
+
- **`scripts/benchmark-pi.mjs`** — the model in the loop, not the testbench: six tasks
|
|
136
|
+
(two data fits, four site builds, one requiring a served-and-stopped HTTP check), each
|
|
137
|
+
with a seeded fixture and machine-graded outcome, every bash *and* `busybox_run` command
|
|
138
|
+
scanned for stream merges (`2>&1`, `|&`, `&>`), the `command` escape counted per call,
|
|
139
|
+
and pi's own crashes reported separately. Its first 12-session run found: a model
|
|
140
|
+
escaping **every** call via the `command` prefix (fixed by rewording the env-section
|
|
141
|
+
escape sentence from "when byte-exact output matters more than timing" to "rarely worth
|
|
142
|
+
it: no timeline, no stream tags, no timing" — escapes then dropped to near zero); three
|
|
143
|
+
`2>&1` idioms with no taught replacement (silencing noise, filtering stderr, server
|
|
144
|
+
logs — each replacement now in the skills, and violations fell 8 → 3 → 1 across
|
|
145
|
+
successive serve-task runs); and a TIMEOUT notice that named the session default even
|
|
146
|
+
when a caller-supplied deadline fired (now it cites a budget only when the run's own
|
|
147
|
+
duration says that budget killed it).
|
|
148
|
+
- **busybox build 2026-11-24 09:42: `json` writes, and `run -x` reports side effects.**
|
|
149
|
+
`busybox json --set`/`--delete` landed — guarded JSON editing (`--value` strings,
|
|
150
|
+
`--json-value` typed, `--dry-run` preview, parses first, missing parent refused exit 1,
|
|
151
|
+
temp+rename) — the hand-rolled python-one-liner class for editing documents is now one
|
|
152
|
+
applet call, and the always-on skill's instead-of table says so. `json` moved from
|
|
153
|
+
read-only to write-on-`--set` in the busybox-applets classification (fourth caveat in
|
|
154
|
+
the R list). `run -x/--effects` reports files created/changed/removed under the run's
|
|
155
|
+
cwd; the JSON payload carries `effects: [{op, path, size}]` and the busybox_run tool
|
|
156
|
+
surfaces it as a compact `effects: +new.txt, -old.txt, ~mod.ts` line (capped at 8, the
|
|
157
|
+
scan's truncation named). Verified against the build: effects print in `--format json`
|
|
158
|
+
only — text mode has no effects section, an upstream gap recorded in the contract, so
|
|
159
|
+
the bash timeline path cannot see them yet. Also verified fixed upstream: `unzip -d`
|
|
160
|
+
extracts correctly now (the plugin's system-unzip-first extraction stays, on purpose).
|
|
161
|
+
Re-verified still open: the JSON payload lacks `idle`.
|
|
162
|
+
- **The 120s silence watchdog** (`run -W`, adopted by default): a command that produces
|
|
163
|
+
no output at all is killed and reported `idle=true` — a *hang*, not slow work — even
|
|
164
|
+
when the deadline was raised. The result carries a third notice, `IDLE — not a
|
|
165
|
+
failure of the command and not a timeout`, naming the most common cause (a command
|
|
166
|
+
reading stdin gets no EOF under the pty) and pointing at the capture. Same budget
|
|
167
|
+
honesty as the deadline notice: the number it cites must match the run's duration.
|
|
168
|
+
`busybox_run` applies the same watchdog, and detects its signature in this build
|
|
169
|
+
(stopped, no exit code, no timeout — the JSON payload does not report `idle`; the text
|
|
170
|
+
header does — an upstream gap). `PI_MANAGED_TOOLS_IDLE=<seconds>` overrides; `0`/`off`
|
|
171
|
+
disables. No watchdog where there is no deadline: `!` commands and fully escaped calls
|
|
172
|
+
stay in their owner's hands.
|
|
173
|
+
- **The view-correctness guard** (`src/guard.ts`): a stream merge at the command's
|
|
174
|
+
*tail* — the last two lines, the last ~24 characters of each, the reflex zone the
|
|
175
|
+
benchmark measured — is now refused *before the command runs*. The blocked call returns
|
|
176
|
+
the rewrite (`>/dev/null` for one stream, `[err]` lines or `busybox log --stream
|
|
177
|
+
stderr --match`, `>srv.log 2>srv.err &` for servers) and the override marker:
|
|
178
|
+
append `# pitime-safe` and say why, and the result then states that its `[out]`/`[err]`
|
|
179
|
+
tags are not evidence. A merge buried deep inside a script the model authored is out of
|
|
180
|
+
scope by design — a rule that nags on first-order scripting gets disabled by its users.
|
|
181
|
+
`busybox_run`'s `shell` argument gets the same guard. `PI_MANAGED_TOOLS_GUARD=off`
|
|
182
|
+
disables it.
|
|
183
|
+
- **Results now state their own holes.** A command that discards stdout or stderr
|
|
184
|
+
(`>/dev/null`, `2>/dev/null`), leaves a process in the background, or runs fully
|
|
185
|
+
unwrapped via the `command` prefix earns a note on its result naming exactly what the
|
|
186
|
+
model cannot know from it — the timeline shows what arrived; it cannot show what was
|
|
187
|
+
thrown away, and saying so is what makes the remaining picture correct.
|
|
188
|
+
- **busybox 0.6.0 (279 applets, up from 276): nanosecond stamps and command metadata.**
|
|
189
|
+
The wrapper now passes `--stamp-ns` — every timeline line is `[00000.005868042 out]`,
|
|
190
|
+
zero-padded, two same-microsecond events distinguishable — while the parser accepts both
|
|
191
|
+
ns (9-digit) and old µs (6-digit, leading-space) shapes, so captures re-read through
|
|
192
|
+
`busybox log` still parse. `run --format json` now reports what the command *did*:
|
|
193
|
+
`cpu_user_ms`/`cpu_sys_ms`, `max_rss_kb`, `binary`, `dropped_bytes`, `final_newline`,
|
|
194
|
+
`cwd_start`, `argv`, `replay` — and `busybox_run` surfaces the interpretation-changing
|
|
195
|
+
ones (cwd, cpu, rss, idle, binary, dropped bytes, missing trailing newline) on a `meta`
|
|
196
|
+
line of its result. Three new agent applets, documented and classified: `mark NAME`
|
|
197
|
+
(named landmarks in a run's timeline, `busybox log <R> --marks`; its only write is the
|
|
198
|
+
run's own marks artifact), `outline FILE` (definitions with line, byte offset and
|
|
199
|
+
version — the index `peek`/`busybox_replace` work from), and `patchapply` (apply a
|
|
200
|
+
unified diff with every hunk verified first, `-c PATH=HASH` refuses on drift, `-n`
|
|
201
|
+
dry-run — the mutating partner of `patchcheck`). New `run` flags documented: `-W`
|
|
202
|
+
idle timeout, `-C` capture limit, `-d` child cwd. Installing a local build on macOS now
|
|
203
|
+
requires `codesign -f -s -` after the copy — an unsigned or stale-signature binary
|
|
204
|
+
gets SIGKILL at exec (this bit the session that installed it: re-signing fixed it).
|
|
205
|
+
- **The human's `!` commands now run through the wrapper** (pi's `user_bash` hook,
|
|
206
|
+
option 2 from its documented contract: hand back `createLocalBashOperations()` with the
|
|
207
|
+
command wrapped inside). `-q --pty-split` passthrough: live streamed output, the
|
|
208
|
+
unbuffered environment, artifacts for `busybox log` — but no timeline, no run header,
|
|
209
|
+
no view budget and no deadline, because the reader is a person who owns the command.
|
|
210
|
+
The `command ` escape falls through to pi's plain path;
|
|
211
|
+
`PI_MANAGED_TOOLS_USER_WRAP=off` restores the plain path entirely.
|
|
212
|
+
- **Common-sense nudges, each verified against the harness before being taught.** Two
|
|
213
|
+
environment facts now stated every turn: each bash call starts fresh in the session's
|
|
214
|
+
cwd (`cd` does not persist — checked), and a command that reads stdin gets no EOF here
|
|
215
|
+
because its stdin is an open pty (`head -1` sat until the deadline, zero bytes —
|
|
216
|
+
measured), so it must be fed (`cmd < file`, `printf … | cmd`, a heredoc).
|
|
217
|
+
- **Three more ways an exit code lies, named on the result.** A pipeline's exit is the
|
|
218
|
+
*last stage's*: ending in `head`/`tail` means the command was SIGPIPE'd and its status
|
|
219
|
+
is unknowable; ending in `grep` means 1 is "no match", not failure; and a `|| true`
|
|
220
|
+
masks whichever segment it follows. Each earns a one-line note stating whose exit code
|
|
221
|
+
the header shows.
|
|
222
|
+
- The one-second pre-emption of pi's deadline lives in the extension only now, emitted
|
|
223
|
+
verbatim by `wrap.ts`; it was being applied twice (`--timeout N-2`), found by the
|
|
224
|
+
testbench's new `timeout-default` scenario (18 scenarios, 104 checks).
|
|
225
|
+
|
|
226
|
+
## [0.21.0]
|
|
227
|
+
|
|
228
|
+
**A testbench, and the five bugs it found.** `npm run testbench` drives the installed
|
|
229
|
+
extension through pi's real bash engine and the real busybox — no model in the loop — over
|
|
230
|
+
17 scenarios (92 checks): quoting, pty buffering, truncation, parallel runs, cancellation,
|
|
231
|
+
timeouts, verbosity, file reads/edits, extraction, retention and the PATH/applet wiring.
|
|
232
|
+
Every scenario runs in its own process and its own scratch agent directory (with a space in
|
|
233
|
+
the path, on purpose), so a failure is a bug and not a prompt misunderstanding.
|
|
234
|
+
|
|
235
|
+
- **An empty busybox silenced every command.** `busyboxAvailable()` only checked that the
|
|
236
|
+
file existed, so a zero-length binary (a truncated download, a half-finished install) was
|
|
237
|
+
wrapped around every bash call: the wrapper could not execute, and every command returned
|
|
238
|
+
nothing at all. It now requires a non-empty file with the executable bit. This was the
|
|
239
|
+
worst failure mode in the package — silent, and total.
|
|
240
|
+
- **Zip-based installs were broken by the applet directory.** `<agent dir>/busybox-applets`
|
|
241
|
+
links `unzip`, so the plugin's own `spawnSync("unzip", …)` resolved to the packaged
|
|
242
|
+
busybox — whose `unzip -d DIR` exits 0 having extracted nothing. Installing ast-grep,
|
|
243
|
+
ninja or gh therefore failed with "Binary not found in archive". Extraction now looks for
|
|
244
|
+
a system binary by absolute path (`/usr/bin/unzip`, then bsdtar, then the packaged busybox
|
|
245
|
+
by absolute path), never through the PATH this package rewrites.
|
|
246
|
+
- **A truncated wrapper view gave no way back.** The wrapper's budget (48 KB) is below pi's
|
|
247
|
+
own (50 KB), so pi never truncates and never offers its temp file: the model saw
|
|
248
|
+
`truncated=true` and nothing else. The `tool_result` digest now names the exact command —
|
|
249
|
+
`busybox log R123 --lines 4960:5000` — because the view keeps the head and the verdict is
|
|
250
|
+
usually at the end.
|
|
251
|
+
- **`busybox_run` lost two things.** Its runs recorded no timeline, so `--stream timeline`
|
|
252
|
+
answered NOT_FOUND; and a literal `match` searched stdout only, missing the diagnostic in
|
|
253
|
+
stderr. It now always records `--timestamps`, and a `match` with no stream named falls
|
|
254
|
+
back to stderr before reporting NOT_FOUND.
|
|
255
|
+
- **Run artifacts grew without bound.** `run --prune N` is silently ignored when
|
|
256
|
+
`--timestamps` is set (measured: 30 runs with `-q --prune 5` leave 5 directories, the same
|
|
257
|
+
30 with `-t --prune 5` leave 30), and the wrapper always asks for the timeline. A session
|
|
258
|
+
left hundreds of directories behind. The extension now sweeps the artifact root itself at
|
|
259
|
+
session start and every 25 wrapped commands, keeping the newest 20 and never touching a
|
|
260
|
+
symlink or a directory that is not `R<number>`.
|
|
261
|
+
|
|
262
|
+
Upstream reports for the busybox repository are in `BUSYBOX-CONTRACT.md`: `unzip -d DIR`
|
|
263
|
+
extracting nothing, `--prune` being inert under `--timestamps`, and the timeline text view
|
|
264
|
+
keeping only the head (the JSON view keeps head and tail).
|
|
265
|
+
|
|
266
|
+
## [0.20.0]
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
- **busybox-static 0.5.0**, which closes both defects the last release reported and adds
|
|
270
|
+
the missing half of "honest timing":
|
|
271
|
+
- `run`'s cancellation was dead code (`bb_signals()` takes `1 << signo`, and `run`
|
|
272
|
+
passed `1 << (signo - 1)`, so the handler sat on SIGHUP/SIGALRM). A SIGTERM now
|
|
273
|
+
records the cancellation and returns the documented exit 3 — verified: `exit 3`,
|
|
274
|
+
`cancelled=true`, no survivor.
|
|
275
|
+
- a watchdog in its own process group kills the command's group when the wrapper dies
|
|
276
|
+
for **any** reason, SIGKILL included. A `kill -9` of busybox no longer orphans the
|
|
277
|
+
work it started, which removes the one hole the plugin could not close.
|
|
278
|
+
- two concurrent runs in one artifact root no longer collide on a run id — relevant
|
|
279
|
+
because pi runs bash calls in parallel.
|
|
280
|
+
- **Wrapped commands get a pseudo-terminal by default** (`--pty-split`: stdout on the
|
|
281
|
+
pty, stderr on a pipe). Buffering was the remaining lie in the timeline: Python, Node,
|
|
282
|
+
Ruby and Java block-buffer stdout on a pipe and flush at exit, so every line shared one
|
|
283
|
+
timestamp. On a terminal they line-buffer, and the offsets become real — a C program that
|
|
284
|
+
`printf`s three lines 1.2 s apart reported all three at `3.740564` on a pipe and at
|
|
285
|
+
`0.004561 / 1.209525 / 2.414571` on the pty. That is the case the env vars cannot
|
|
286
|
+
reach: Python and Ruby have switches (set anyway), C stdio, Java and Go's `bufio`
|
|
287
|
+
only have the terminal. stderr is unbuffered
|
|
288
|
+
either way, so it keeps its pipe and its `err` tag. `PI_MANAGED_TOOLS_PTY` selects
|
|
289
|
+
`split` (default), `merged`, `raw` or `off`, and `/managed-tools pty` (or the
|
|
290
|
+
`managed_tools` tool's `pty` action) changes it for a session. `isatty()` being true is
|
|
291
|
+
the one behavioural change, and `off` restores plain pipes.
|
|
292
|
+
- **A `timing:` digest line** is appended to any bash result that ran longer than a second,
|
|
293
|
+
for the model: total, line count, where output began, the longest silence, and how many
|
|
294
|
+
pauses there were. It answers "where did the time go" without asking the model to diff
|
|
295
|
+
300 timestamps, and the bash renderer strips it for the human.
|
|
296
|
+
- **`rtk` is removed.** It is no longer downloaded, updated, installed or advertised:
|
|
297
|
+
summarising output is a preference rather than a pinned binary, and a proxy that
|
|
298
|
+
rewrites what a command printed is the wrong default for a model that has to read diffs
|
|
299
|
+
and edit files. The always-on skill now leads with the packaged binaries and points at
|
|
300
|
+
`brief` for reduction; both skills lost every rtk reference (a test enforces that), and
|
|
301
|
+
an existing `<agent dir>/bin/rtk` is left untouched. The registry is 24 tools.
|
|
302
|
+
- The wrapper keeps its deadline grace (`--timeout N-1`) even though 0.5.0 handles a
|
|
303
|
+
signal correctly: it costs nothing and makes the applet the owner of the deadline.
|
|
304
|
+
|
|
305
|
+
## [0.19.0]
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
- **The packaged busybox moves to busybox-static 0.4.0** (276 applets, was 269), which
|
|
309
|
+
brings the high-precision timeline, `brief`, deadline control and the fixes this
|
|
310
|
+
plugin had worked around. `busybox-static` now tags releases with its own version
|
|
311
|
+
(v0.4.0) while the assets keep the upstream build version
|
|
312
|
+
(`busybox-static-1.39.0-aac079e-darwin-universal`), so the busybox entry resolves its
|
|
313
|
+
asset from the release's own asset list (`assetPattern`) instead of constructing a
|
|
314
|
+
name from the tag. A version recorded under the old scheme (`1.39.0-aac079e`, which
|
|
315
|
+
sorts *above* 0.4.0) is treated as older by `legacyVersionPattern`, otherwise every
|
|
316
|
+
installed copy would look newer than the new release forever.
|
|
317
|
+
- **Every bash command now runs through `busybox run --timestamps`.** The model reads
|
|
318
|
+
one interleaved line per record with a microsecond offset and its stream
|
|
319
|
+
(`[ 0.066632 err]`), which is the ordering evidence a merged stdout/stderr block
|
|
320
|
+
destroys. pi's own bash runner is reused through `createBashToolDefinition` (the
|
|
321
|
+
documented override path), so exit status, cwd, shell, truncation and process-tree
|
|
322
|
+
killing are unchanged.
|
|
323
|
+
- **The timeline is for the model only.** The re-registered `bash` tool supplies
|
|
324
|
+
`renderResult`, which strips the wrapper's header, markers and per-line prefixes for
|
|
325
|
+
the TUI and HTML export, keeping everything the command printed. The tool result —
|
|
326
|
+
what the model reads and the session stores — keeps the timeline.
|
|
327
|
+
- The wrapped command carries the unbuffered environment it needs rather than exporting
|
|
328
|
+
it into pi's process: `PYTHONUNBUFFERED`, `NO_COLOR`, `TERM=dumb`, `PAGER`/`GIT_PAGER`,
|
|
329
|
+
`MAVEN_ARGS`, `GRADLE_OPTS`, and a generated Ruby prelude wired through `RUBYOPT` (the
|
|
330
|
+
only way to set `$stdout.sync` from outside). Go and Java have no such switch; the
|
|
331
|
+
timeline shows their flush boundaries instead. `PI_MANAGED_TOOLS_EXTRA_ENV` adds more.
|
|
332
|
+
- **Session verbosity**: `managed_tools` gains a `verbosity` action and `/managed-tools`
|
|
333
|
+
a `verbosity` verb — `quiet` (6 KB view), `normal` (48 KB, default), `verbose`
|
|
334
|
+
(200 KB) or `brief` (repeats collapsed through `brief`, no timeline — this build
|
|
335
|
+
ignores `--brief` when `--timestamps` is set). `PI_MANAGED_TOOLS_WRAP=off` disables
|
|
336
|
+
the wrapper entirely.
|
|
337
|
+
- Escape hatch for byte-exact output: a command (or any `&&`/`;` segment) prefixed with
|
|
338
|
+
`command` runs unwrapped — a leading-only check was not enough, because a model writes
|
|
339
|
+
`cd /repo && jq ...`.
|
|
340
|
+
- `peek`, `waitfor`, `doctor`, `brief`, `why` and `patchcheck` are linked into
|
|
341
|
+
`<agent dir>/busybox-applets` (62 names). `replace`, `run`, `log`, `bench`, `check`,
|
|
342
|
+
`json` and `snapshot` stay out: they execute, write, or own a generic name.
|
|
343
|
+
- Two of the defects recorded in `BUSYBOX-CONTRACT.md` are fixed upstream and the
|
|
344
|
+
document now says so: `run --format json` is valid when the view truncates (the
|
|
345
|
+
omission marker is inside the string), a zero-match `replace` answers `NOT_FOUND` with
|
|
346
|
+
a message, and `--sha256` accepts the 12-character prefix `peek` prints. One remains
|
|
347
|
+
and is documented with the fix: an external SIGTERM/SIGKILL to `run` leaves the child's
|
|
348
|
+
process group behind.
|
|
349
|
+
|
|
350
|
+
## [0.18.1]
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
- Add **`BUSYBOX-CONTRACT.md`**: every argv, JSON field, exit code and payload shape
|
|
354
|
+
this plugin depends on, captured from the real build and written for the
|
|
355
|
+
`busybox-static` repository to keep compatible. `scripts/capture-busybox-contract.sh`
|
|
356
|
+
re-captures all of it from any build (read-only, `BUSYBOX=/path` overrides the
|
|
357
|
+
binary), and a test fails if the document stops naming a flag the wrapper uses.
|
|
358
|
+
- Three wrappers were wrong about the build, and the contract work is what found them:
|
|
359
|
+
- `peek`'s `next` is `{"from_byte":N}`, not a number, so the continuation hint for a
|
|
360
|
+
truncated read never rendered and the caller had to re-read from the start.
|
|
361
|
+
- A zero-match `replace` answers `INVALID_ARGUMENT` with an **empty** message, not
|
|
362
|
+
`NOT_FOUND`, so the text now says "(the build sent no message)" instead of
|
|
363
|
+
inventing "no change".
|
|
364
|
+
- A `--request` batch continues past `INVALID_ARGUMENT` and only stops on
|
|
365
|
+
`STALE_INPUT`/`NOT_FOUND`, so the batch summary says "check each result" rather
|
|
366
|
+
than promising that later edits were skipped.
|
|
367
|
+
- Two defects reported upstream in the same document, both with reproductions:
|
|
368
|
+
`run --format json` is invalid JSON when the view is truncated (the head and tail
|
|
369
|
+
are printed as two adjacent strings), and a spawn failure comes back as
|
|
370
|
+
`exit_code:127` with no distinct wrapper status.
|
|
371
|
+
|
|
372
|
+
## [0.18.0]
|
|
373
|
+
|
|
374
|
+
- **The packaged BusyBox is now the agent-ops build: 269 applets on Darwin** (416 on
|
|
375
|
+
Linux), up from 236. It carries six applets that exist for a coding agent rather
|
|
376
|
+
than a shell, all sharing one contract (text by default, `--format json` with
|
|
377
|
+
`"schema":1`, explicit byte budgets, `shown_bytes`/`truncated`, exit 0/1/2/3 and
|
|
378
|
+
never 124 or 128+N): `peek` (numbered lines plus the file `sha256`, with a
|
|
379
|
+
`--from-byte` continuation), `replace` (literal, validated-before-write, atomic,
|
|
380
|
+
`--sha256` precondition, `--dry-run` diff), `run`/`log` (argv or `--shell`, separate
|
|
381
|
+
stdout/stderr artifacts, bounded view, own deadline and process-group cleanup,
|
|
382
|
+
retrieval by line range or literal match), `waitfor` (bounded file/TCP/unix/HTTP
|
|
383
|
+
readiness) and `doctor`. `busybox --caps --format json` reports the build's real
|
|
384
|
+
version, applet count and features. The other new applets (`chpst`, `column`,
|
|
385
|
+
`fallocate`, `fdisk`, `free`, `fuser`, `ifconfig`, `ip`, `lsblk`, `mount`, `pgrep`,
|
|
386
|
+
`pidof`, `ping`, `pkill`, `ps`, `pstree`, `readahead`, `reset`, `route`,
|
|
387
|
+
`setuidgid`, `softlimit`, `top`, `umount`, `uptime`, `watch`, ...) are classified in
|
|
388
|
+
the `busybox-applets` skill.
|
|
389
|
+
- **Three model tools over those applets**, each chosen because the built-in it
|
|
390
|
+
resembles lacks exactly one property: `busybox_peek` (a read that returns the file
|
|
391
|
+
version), `busybox_replace` (`edit` with a `sha256` precondition, so a stale hash is
|
|
392
|
+
`STALE_INPUT` and nothing is written; `dry_run` returns a bounded diff),
|
|
393
|
+
`busybox_run` (`bash` with retrievable evidence: the capture is complete when the
|
|
394
|
+
view is trimmed, and a nonzero `exit_code` is the command's status, not a tool
|
|
395
|
+
failure). They spawn the packaged binary and format its JSON; no guarantee (byte
|
|
396
|
+
budget, `flock`, process-group cleanup, 0600 artifacts) is re-implemented in
|
|
397
|
+
TypeScript. Cancelling a call sends TERM then KILL, and the applet reaps its own
|
|
398
|
+
group. `read`, `edit` and `bash` remain the defaults.
|
|
399
|
+
- `peek`, `waitfor` and `doctor` are linked into `<agent dir>/busybox-applets` (59
|
|
400
|
+
names now), so they are bare commands too. `replace`, `run` and `log` are left out:
|
|
401
|
+
two of those names are generic enough for a project script to own, and all three
|
|
402
|
+
mutate or execute.
|
|
403
|
+
- **Worked around an upstream JSON bug**: this build prints `run --format json` with
|
|
404
|
+
the head and tail of a truncated view as two adjacent quoted strings, which no
|
|
405
|
+
parser accepts. The metadata is intact and the capture is complete, so the wrapper
|
|
406
|
+
recovers the fields from the text and points at `run_id` for the view — it never
|
|
407
|
+
re-runs the command, because that would repeat its side effects. Reported upstream
|
|
408
|
+
in the build repo; `peek` and `log` JSON are unaffected.
|
|
409
|
+
- Tests: 130 (was 100). New `tests/agentops.test.ts` covers argv building, the text
|
|
410
|
+
the model reads, salvage of the broken payload, and cancellation against a stand-in
|
|
411
|
+
multicall binary; the extension tests drive the three tools through the same
|
|
412
|
+
stand-in. The skills test now checks the 269-applet roster.
|
|
413
|
+
|
|
414
|
+
## [0.17.0]
|
|
415
|
+
|
|
416
|
+
- **BusyBox applet names are now on `PATH`**, in a second directory after the bin
|
|
417
|
+
directory: `<agent dir>/busybox-applets` holds one symlink per applet, each
|
|
418
|
+
pointing at `<agent dir>/bin/busybox`, so `xxd`, `hexdump`, `sha256sum`, `unzip`,
|
|
419
|
+
`timeout` and 51 more run without the `busybox` prefix. BusyBox dispatches on
|
|
420
|
+
`argv[0]`, so a symlink is the only way to do this without renaming the binary.
|
|
421
|
+
The default list is curated (56 applets, `CORE_APPLETS` in `src/tools.ts`): names
|
|
422
|
+
where the host may lack the tool, or where the busybox flags are adequate.
|
|
423
|
+
`sed`, `grep`, `find`, `awk`, `tar`, `diff`, `ls`, `cp`, `rm`, `stat`, `date`,
|
|
424
|
+
`patch`, `tree` and the shells are deliberately **not** linked, so no working
|
|
425
|
+
command changes meaning; they stay reachable as `busybox <applet>`.
|
|
426
|
+
`PI_MANAGED_TOOLS_APPLETS=all` widens this to every applet except a never-list
|
|
427
|
+
(system administration, servers, package managers, shells); `off` disables it.
|
|
428
|
+
- **The extension now sets `PATH` itself**, as
|
|
429
|
+
`<agent dir>/bin : <agent dir>/busybox-applets : rest`, dropping any earlier
|
|
430
|
+
occurrence of its own entries before prepending. pi's `getShellEnv()` prepends
|
|
431
|
+
the bin directory only when it is *absent* and offers no hook for a second
|
|
432
|
+
directory, so rewriting `process.env.PATH` at session start is the only way to
|
|
433
|
+
reach every `bash` spawn. This also fixes the documented case where a shell rc
|
|
434
|
+
appended `$HOME/.pi/agent/bin` and host binaries won for `bash`.
|
|
435
|
+
- The system-prompt environment section now names both `PATH` entries and states
|
|
436
|
+
which names are not shadowed; `/managed-tools status` reports the applet links.
|
|
437
|
+
- Absolute host paths to a linked applet (`/usr/bin/xxd`) are rewritten to the bare
|
|
438
|
+
name, as managed binary paths already were.
|
|
439
|
+
- A relative symlink target was tried first and rejected: the kernel resolves a
|
|
440
|
+
relative link from the *real* directory, so under macOS `/tmp` (a symlink to
|
|
441
|
+
`/private/tmp`) `..` walks through the target side and the link dangles. Links
|
|
442
|
+
are absolute, and a moved agent directory is repaired by the next sync.
|
|
443
|
+
|
|
3
444
|
## [0.16.0]
|
|
4
445
|
|
|
5
446
|
- Renamed the npm package to the scoped name **`@rob-c/pi-managed-tools`**; install
|