Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
2e13753
fix: make notebook writes byte-stable
Nov 18, 2026
d64a86f
feat: report the write mode instead of falling back silently
Nov 18, 2026
d1f7159
feat: add a warning sink so swallowed failures stay observable
Nov 18, 2026
99c508a
perf: parse the notebook once and match moved values by identity
Nov 18, 2026
d7649db
perf: detect non-ASCII escapes with a native regex scan
Nov 18, 2026
92abf17
fix: insert defaulted keys without reordering unsorted notebooks
Nov 18, 2026
3420aa6
test: verify the write lock and source splitting formally
Nov 18, 2026
0aa158b
chore: drop explanatory comments from the notebook write path
Nov 18, 2026
4447ef1
test: measure write scaling in CI
Nov 18, 2026
ff95a54
docs: write down the review and verification protocol
Nov 18, 2026
2dee661
fix: report atomic-replace and plugin teardown failures
Nov 18, 2026
3a7791b
fix: report temp-file cleanup failures in the notebook writer
Nov 18, 2026
b3f7046
chore: remove the remaining comments from src
Nov 18, 2026
508249e
fix: report path, permission and process-kill failures
Nov 18, 2026
afd0d60
feat: deliver collected warnings to the tool result
Nov 18, 2026
0d3921a
docs: name the failures that stay silent on purpose
Nov 18, 2026
3458133
fix: report kernel, sidecar and diagnostics failures
Nov 18, 2026
ba81664
fix: surface sidecar warnings from ipynb_lsp materialize
Nov 18, 2026
3fe5ebe
refactor: apply defaults without mutating the parsed notebook
Nov 18, 2026
5b54f5e
feat: report how many sources ipynb_clean normalized
Nov 18, 2026
d9bd089
fix: decide output text shape per value, not per cell
Nov 18, 2026
7b99d32
proof: validate insertSorted, formatSourceLike and applyNotebookDefau…
Nov 18, 2026
281e099
spec: model the execution save protocol in TLA+
Nov 18, 2026
b6ceb95
fix: report write-path probe failures to the warning sink
Nov 18, 2026
c079d94
test: guard the remaining silent failures behind an allowlist
Nov 18, 2026
8e6acf4
perf: validate the notebook object instead of re-parsing the write text
Nov 18, 2026
6daebbb
fix: make hasAnsi stateless across calls
Restodecoca Nov 18, 2026
46fdff9
refactor: extract mergeExecutedOutputs from the run-save path
Restodecoca Nov 18, 2026
970e63a
perf: index run summaries by cell instead of scanning per cell
Restodecoca Nov 18, 2026
9e6a32e
perf: binary-search virtual document positions
Restodecoca Nov 18, 2026
6f3fdbf
perf: index patchObject removals and anchors
Restodecoca Nov 18, 2026
7ef0382
proof: applyEdits splicing and markdown truncation contracts
Restodecoca Nov 18, 2026
42cabc4
spec: model the atomic replace protocol and its in-place twin
Restodecoca Nov 18, 2026
23649af
feat: skip the filesystem when a rewrite is byte-identical
Restodecoca Nov 18, 2026
af727aa
test: probe warnings need a write that actually lands
Restodecoca Nov 18, 2026
c90dda6
feat: fsync the temp file before the atomic rename
Restodecoca Nov 18, 2026
5f5c446
perf: check multiline layout without slicing node spans
Restodecoca Nov 18, 2026
f00be4d
perf: collect streams in arrays and join once
Restodecoca Nov 18, 2026
6de4f58
feat: refuse shell execution when the command line has metacharacters
Restodecoca Nov 18, 2026
672e226
fix: pass the warning sink into the save-path atomic replace
Restodecoca Nov 18, 2026
6a745cd
fix: patch objects whose every original key is replaced
Restodecoca Nov 18, 2026
0899004
fix: report the write outcome on every notebook write path
Restodecoca Nov 18, 2026
3c58b6d
fix: make kill-path and options failures observable
Restodecoca Nov 18, 2026
716340c
test: let the silence guard see multi-line catches
Restodecoca Nov 18, 2026
9549f07
fix: state the ApplyEdits theorems over the sorted, valid edit domain
Restodecoca Nov 18, 2026
12dcf71
fix: model the CR normalization the truncator really does
Restodecoca Nov 18, 2026
53716c4
fix: restrict the string-sort theorem to where UTF-16 is code-point o…
Restodecoca Nov 18, 2026
b9c4ea5
spec: model the warning ring's dedup-set clear honestly
Restodecoca Nov 18, 2026
6cedaca
spec: check a save invariant that pins the recheck
Restodecoca Nov 18, 2026
aa2f89a
spec: give the write lock an honest abort and a real recheck property
Restodecoca Nov 18, 2026
d2d4be6
spec: drop the decorative exit-code line from the last twin expect
Restodecoca Nov 18, 2026
6299b7c
docs: state the twin, vacuity-probe, and atomicity disciplines for specs
Restodecoca Nov 18, 2026
b1e5921
perf: skip the sidecar rewrite when its content is already current
Restodecoca Nov 18, 2026
c50465c
docs: record the hardening wave in the unreleased changelog
Restodecoca Nov 18, 2026
0ac4b83
test: pin the applyEdits sort and overlap rejection
Restodecoca Nov 18, 2026
c4b5a16
proof: compose the defaults pass and prove it idempotent
Restodecoca Nov 18, 2026
de6aced
docs: map the write-outcome and warning flow in the architecture guide
Restodecoca Nov 18, 2026
68a4984
test: pin the loud rejection of a BOM notebook
Restodecoca Nov 18, 2026
18d5e2a
proof: match the overlap hypothesis to the real sort order
Restodecoca Nov 18, 2026
9468905
proof: widen bmpSafe to the exact order-agreeing domain
Restodecoca Nov 18, 2026
85faad9
spec: state the lock's check-to-write collapse like the save spec does
Restodecoca Nov 18, 2026
8d18955
test: pin the doctor's plugin-options warning section
Restodecoca Nov 18, 2026
1d072dd
refactor: drop the dead format-detection warning source
Restodecoca Nov 18, 2026
614bf5a
chore: remove the TLC trace artifacts after a successful verify
Restodecoca Nov 18, 2026
4ad9ff6
fix: render an added key with its own object's layout
Restodecoca Nov 18, 2026
aecf172
test: pin the anchor for a key added to an unsorted object
Restodecoca Nov 18, 2026
0b5752c
fix: decode notebooks as strict UTF-8 and never rewrite invalid bytes
Restodecoca Nov 18, 2026
6e8a50c
test: fuzz the patcher against generated documents and edits
Restodecoca Nov 18, 2026
8b13cba
chore: lint the python helper in CI
Restodecoca Nov 18, 2026
eef4b46
test: pin that a denied edit never reaches the notebook
Restodecoca Nov 18, 2026
13d2a9e
docs: record the manual host smoke test
Restodecoca Nov 18, 2026
d384b67
test: pin kernel-manager disposal per plugin scope
Restodecoca Nov 18, 2026
097a81f
perf: keep the patcher linear for interleaved keys and bound escaping
Restodecoca Nov 18, 2026
6e4bede
perf: strip OSC sequences with a bounded linear scan
Restodecoca Nov 18, 2026
d067f00
perf: check pyright availability before loading the notebook
Restodecoca Nov 18, 2026
e2f958a
fix: normalize drive roots so windows confinement cannot be bypassed
Restodecoca Nov 18, 2026
0eb1772
fix: refuse a tool call whose context is already cancelled
Restodecoca Nov 18, 2026
f279103
test: make the suite pass on a real windows host
Restodecoca Nov 18, 2026
5903949
fix: report a concurrently replaced write instead of losing it silently
Restodecoca Nov 18, 2026
eeaf720
fix: make handle-close failures observable and clean the diagnostics …
Restodecoca Nov 18, 2026
0f6a0d5
fix: drop dead kernel states and reap killed process groups
Restodecoca Nov 18, 2026
123b52d
fix: keep failed sidecars tracked and preserve concurrent additions
Restodecoca Nov 18, 2026
33a9365
ci: run the test suite on windows
Restodecoca Nov 18, 2026
61c4914
fix: keep the write uninterruptible and finish stdin listener cleanup
Restodecoca Nov 18, 2026
18b8065
fix: refuse a directory target on the windows replace fallback
Restodecoca Nov 18, 2026
5e900d1
fix: retry a transient realpath ENOENT instead of reporting the noteb…
Restodecoca Nov 18, 2026
63766b4
fix: stop a kernel started through a symlink after the link is deleted
Restodecoca Nov 18, 2026
ed92fef
docs: record cancellation, concurrency, and windows hardening
Restodecoca Nov 18, 2026
a207c8e
ci: run typecheck and tests on macos
Restodecoca Nov 18, 2026
74562c4
fix: reconcile sidecar tracking over the cleanup snapshot
Restodecoca Nov 18, 2026
dde7fca
fix: bound the kernel alias map on idle and pre-aborted paths
Restodecoca Nov 18, 2026
f498f2a
fix: guard raw tool definitions against an aborted context
Restodecoca Nov 18, 2026
20afc8b
fix: refuse to overwrite a notebook the write path cannot read
Restodecoca Nov 18, 2026
dd8d34a
test: pin the edit path's write-outcome propagation
Restodecoca Nov 18, 2026
f07a127
fix: keep diagnostics and kernel warnings on the caller's sink
Restodecoca Nov 18, 2026
26ca5cd
fix: retry transient realpath on the lock key and write target too
Restodecoca Nov 18, 2026
86d7339
spec: make the lock's mutual exclusion a real property
Restodecoca Nov 18, 2026
71e7b8b
test: keep the write-path realpath warning pin specific to its source
Restodecoca Nov 18, 2026
784adab
proof: model the code-unit order the insert actually sorts with
Restodecoca Nov 18, 2026
2818cc6
fix: assert read before an editing tool parses the notebook
Restodecoca Nov 18, 2026
d9c26ec
fix: detect a lost write from an in-place saver too
Restodecoca Nov 18, 2026
04213be
proof: drop a sortedness claim about an order production never uses
Restodecoca Nov 18, 2026
8f64a28
fix: recover from a dead kernel and bound the line guard by bytes
Restodecoca Nov 18, 2026
852d675
fix: assert lsp permission before spawning pyright and name its binary
Restodecoca Nov 18, 2026
8a57da4
fix: reject misspelled tool arguments instead of dropping them
Restodecoca Nov 18, 2026
a51b80e
fix: keep one kernel manager per scope regardless of the sink
Restodecoca Nov 18, 2026
843f8e2
fix: refuse the write when a call is cancelled during the permission …
Restodecoca Nov 18, 2026
27283ce
fix: scope a kernel teardown to the request that owns the failure
Restodecoca Nov 18, 2026
4346fa5
fix: make the warm request timer a per-cell budget, not a queue clock
Restodecoca Nov 18, 2026
46cc7bb
fix: require a per-request nonce before a warm kernel line settles a …
Restodecoca Nov 18, 2026
1557ce1
fix: keep per-cell outputs and raw MIME bundles when saving
Restodecoca Nov 18, 2026
584f027
fix: re-check containment right before the notebook and sidecar rename
Restodecoca Nov 18, 2026
1825439
perf: stop burning the retry budget on a genuinely absent path
Restodecoca Nov 18, 2026
aa437b1
spec: add the warning-ring twin, model the clamped hint, widen the si…
Restodecoca Nov 18, 2026
e8e5799
chore: gate the package on its real contents and current build
Restodecoca Nov 18, 2026
eb94250
docs: make three shipped-behavior claims match the code
Restodecoca Nov 18, 2026
3e7f48a
fix: refuse the write when the revision re-read fails for a real error
Restodecoca Nov 18, 2026
82fe10b
fix: reject a wrongly typed timeout or output budget with a structure…
Restodecoca Nov 18, 2026
55e2f69
fix: keep the env report usable when pip is missing
Restodecoca Nov 18, 2026
dd27e69
fix: refuse an export path that is not an export document
Restodecoca Nov 18, 2026
ee250e7
fix: refuse a serve request that names a different notebook
Restodecoca Nov 18, 2026
7a6c023
fix: accept a code cell that omits execution_count
Restodecoca Nov 18, 2026
1245844
fix: name the offending field in a union validation failure
Restodecoca Nov 18, 2026
c80e2c8
feat: express the read/outputs requirements in the generated schema
Restodecoca Nov 18, 2026
91c3a37
fix: fail an over-nested notebook with a named limit, not a stack ove…
Restodecoca Nov 18, 2026
78441af
fix: exit the helper when its parent disappears
Restodecoca Nov 18, 2026
4bb05a2
perf: stop re-validating a notebook the caller already read, and boun…
Restodecoca Nov 18, 2026
a58a663
perf: escape non-ASCII with a lookup table instead of per-character c…
Restodecoca Nov 18, 2026
7dc8063
perf: stop re-parsing every token and index only the changed span
Restodecoca Nov 18, 2026
8250dbc
perf: build the node tree from offsets and parse the value once natively
Restodecoca Nov 18, 2026
ef1d76e
bench: assert a memory ceiling on the large-edit path and record two …
Restodecoca Nov 18, 2026
b2df224
perf: store array item spans and materialize only the changed ones
Restodecoca Nov 18, 2026
9f52918
ci: capture a rare suite failure instead of losing it
Restodecoca Nov 18, 2026
6d97124
fix: let a queued shutdown preempt a running cell
Restodecoca Nov 18, 2026
8d971a2
bench: measure the object-heavy patch and tighten the edit ceilings
Restodecoca Nov 18, 2026
30e6601
docs: state the measured edit footprint and give the bench headroom
Restodecoca Nov 18, 2026
14c94a1
bench: label the edit budgets as absolute and correct the footprint c…
Restodecoca Nov 18, 2026
24b271e
bench: pin the patch allocation with a fixed-workload guard
Restodecoca Nov 18, 2026
f33a1ef
fix: make the allocation guard bite and close the quality-review gaps
Restodecoca Nov 18, 2026
dd7427b
perf: remove three super-linear paths the cpu audit measured
Restodecoca Nov 18, 2026
ee9d187
fix: report a failed write when the notebook vanishes right after the…
Restodecoca Nov 18, 2026
a41a564
docs: stop claiming guarantees the code does not provide, and ship th…
Restodecoca Nov 18, 2026
4cf1f5b
fix: stop emitting lone surrogates and dropping unrepresentable values
Restodecoca Nov 18, 2026
f5aafc7
spec: state the scope the models actually cover
Restodecoca Nov 18, 2026
d911cd7
bench: say when the allocation guard cannot measure instead of passing
Restodecoca Nov 18, 2026
ed2ef3c
fix: remove the temp a failed parent-swap write leaves behind, and ca…
Restodecoca Nov 18, 2026
edf80c9
fix: keep diagnostics when pyright reports a file-level error
Restodecoca Nov 18, 2026
1ef0279
fix: sync the directory and the exported file so a success is durable
Restodecoca Nov 18, 2026
f74c520
perf: bound the pyright and dependency caches, and record why the rev…
Restodecoca Nov 18, 2026
c9660d2
fix: skip the directory sync on win32, where it cannot work
Restodecoca Nov 18, 2026
1ea7d8c
release: 3.0.0
Restodecoca Nov 19, 2026
1a31928
test: run the helper suites where CI runs them, and fix two fragile a…
Restodecoca Nov 19, 2026
5650edf
fix: resolve the deepest existing ancestor when materializing virtual…
Restodecoca Nov 19, 2026
3edfee3
fix: keep warm-kernel lookup and listing on the caller's path spelling
Restodecoca Nov 19, 2026
49bbba1
test: compare what a path denotes instead of how it is spelled
Restodecoca Nov 19, 2026
6e27ddd
test: simulate the refused kill instead of depending on OS PIDs
Restodecoca Nov 19, 2026
af757c4
test: make the realpath retry test honest on every platform
Restodecoca Nov 19, 2026
c24b97a
test: skip the fake pyright when no python interpreter is usable
Restodecoca Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 98 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
- name: Install Python test dependencies
run: python -m pip install -r python/requirements-test.txt

- name: Lint the Python helper
run: |
python -m pip install ruff==0.17.5
python -m ruff check --select F,E9 python/

- name: Install Node dependencies
run: bun install --frozen-lockfile

Expand All @@ -54,24 +59,83 @@ jobs:
SKIP_LOCK_BENCH: "1"
run: |
set -o pipefail
bun test --coverage 2>&1 | tee coverage.txt
awk -F'|' '/All files/ { found=1; gsub(/ /,"",$3); if ($3+0 < 80) { print "Line coverage below 80%"; exit 1 } } END { if (!found) { print "Coverage summary not found"; exit 2 } }' coverage.txt

- name: Upload coverage
attempt=1
status=1
while [ "$attempt" -le 3 ]; do
set +e
bun test --coverage > "test-run-$attempt.log" 2>&1
run_status=$?
set -e
cat "test-run-$attempt.log"
if [ "$run_status" -eq 0 ]; then
status=0
break
fi
status=1
if grep -qE '\(fail\)' "test-run-$attempt.log"; then
echo "::error::test failures on attempt $attempt"
grep -E '\(fail\)' "test-run-$attempt.log" || true
fi
attempt=$((attempt + 1))
done
# After the loop `attempt` is one past the last run when every try failed.
last=$(( attempt > 3 ? 3 : attempt ))
cp "test-run-$last.log" coverage.txt
grep -E 'All files' "test-run-$last.log" > coverage-summary.txt || true
awk -F'|' '/All files/ { found=1; gsub(/ /,"",$3); if ($3+0 < 80) { print "Line coverage below 80%"; exit 1 } } END { if (!found) { print "Coverage summary not found"; exit 2 } }' coverage-summary.txt
exit "$status"

- name: Upload coverage and every test attempt
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.txt
if-no-files-found: error
path: |
coverage.txt
coverage-summary.txt
test-run-*.log
if-no-files-found: warn

- name: Write scaling benchmark
run: bun run scripts/bench-writes.ts

- name: Build
run: bun run build

- name: Package dry run
run: npm pack --dry-run

formal:
name: TLA+ models and Lean proofs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Java for TLC
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"

- name: Install TLA+ tools
run: |
curl -fsSL -o tla2tools.jar https://github.com/tlaplus/tlaplus/releases/download/v1.8.0/tla2tools.jar
echo "TLA_JAR=$PWD/tla2tools.jar" >> "$GITHUB_ENV"

- name: Setup Lean
uses: leanprover/lean-action@v1
with:
lake-package-directory: proofs
auto-config: false
build: true
use-github-cache: false

- name: Verify
run: ./scripts-verify.sh

windows-typecheck:
name: Windows typecheck
name: Windows typecheck and tests
runs-on: windows-latest
steps:
- name: Checkout
Expand All @@ -90,3 +154,30 @@ jobs:

- name: Typecheck tests
run: bun run typecheck:tests

- name: Test
run: bun test

macos:
name: macOS typecheck and tests
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.4.4"

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Typecheck
run: bun run typecheck

- name: Typecheck tests
run: bun run typecheck:tests

- name: Test
run: bun test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dist/
.env.local
.idea/
.vscode/
*.tsbuildinfo
.bun/
.pytest_cache/
__pycache__/
Expand All @@ -15,6 +14,11 @@ __pycache__/
venv/
.tsbuildinfo

# Build and write artifacts that must never be committed
*.tgz
*.bak
*.tmp

# Contributor-only docs that are NOT shipped to npm and NOT versioned in git.
# They are kept locally for development and live in AGENTS.md / TODO.md,
# but the canonical, public roadmap and contributor guide live on GitHub:
Expand Down
150 changes: 150 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,155 @@
# Changelog

## 3.0.0

Byte-stable writes, a hardened tool boundary, and measured performance. The one
breaking change for existing callers is `ipynb_export`'s output extension; it is
first so it is easy to find.

### Breaking

- `ipynb_export` refuses an `outputPath` that does not end in `.md`, `.markdown`,
`.py`, `.txt` or `.rst` (after the win32 trailing dot/space normalization).
Previously any path that was not a `.ipynb` was written, which let a mistaken
prompt overwrite `.env`, `package.json` or a key file; the tool description
states the restriction.

### Correctness

- Writes are byte-stable (issue #2): the zod schemas validate only, and the raw
`JSON.parse` object is passed through unchanged (`applyNotebookDefaults` is
pure and returns a clone), so no write re-emits the notebook in
schema-declaration order. `src/utils/json-patch.ts` splices only the changed
values into the stored text, so untouched bytes keep their key order, layout,
escapes, and number literals.
- `ipynb_edit` mirrors the stored `source` shape: a notebook that stores line
arrays keeps line arrays (split like nbformat/`splitlines(keepends=True)`); a
single-string notebook keeps one string. Inserted cells inherit the shape of
the notebook's first cell.
- `ipynb_run save=true` splits the `stream.text`/text-mime strings that
`nbformat.read` rejoins when the notebook stores `source` as line arrays, so
saving outputs does not reflow those outputs.
- `ipynb_run save=true` gives every cell its own share of `maxOutputChars`
instead of draining one pool: later cells used to be persisted with empty
`stdout` over real output. Raw MIME bundles are persisted verbatim, so a
`text/html` or `image/png` display data survives a save instead of being
replaced by a `text/plain` summary.
- Defaulted keys (`metadata`, cell `outputs`) are inserted in sorted position
when the object's keys are already sorted, and appended otherwise, so an
existing key order is never reordered to make room for a default.
- A code cell that omits `execution_count` is accepted (nbformat treats the field
as optional) and a rewrite keeps the key absent instead of injecting it.
- Union validation failures name the offending field and the accepted values
(`cells.0.cell_type: expected "markdown"`) instead of collapsing to
`Invalid input`.
- Deeply nested values are refused with the depth limit named (512) instead of
surfacing a `Maximum call stack size exceeded`.
- A custom JSON Schema is generated with `additionalProperties: false` and the
`ipynb_read` / `ipynb_outputs` argument rules, so a misspelled argument or a
call the tool would reject is refused before it runs. A misspelled
`clear_outputs` used to be dropped and wiped outputs.
- `truncateMarkdown` no longer emits a lone surrogate when a budget splits an
astral character.
- A value JSON cannot represent (`undefined`, `BigInt`, a cycle) is refused with
an actionable message instead of being dropped and reported as a successful
write.

### Data safety and atomicity

- A notebook whose bytes are not valid UTF-8, or that starts with a BOM, is
rejected at read time instead of being decoded with replacement characters
and silently rewritten later.
- A tool call cancelled during the permission prompt writes nothing; a retried
insert or delete cannot apply twice.
- A write that another process replaces immediately after the rename fails with
a concurrent-replacement error instead of reporting success for a change that
is no longer in the file, and a file deleted right after the rename is
reported instead of silently succeeding.
- A write refused by a parent-directory swap no longer leaves the full new
notebook content behind as a hidden `.tmp`: cleanup tracks wherever the temp
moved and sweeps the unique name beside the original directory.
- The notebook write and the export are fsynced (content and directory, on
POSIX), so a returned success survives a crash.
- The parent directory is re-resolved and the containment re-checked immediately
before the rename, for notebook writes and for the LSP sidecar.
- An unreadable target is refused by the pre-rename revision re-read instead of
warning and writing anyway.
- Windows path confinement no longer accepts a drive root, a path on another
drive, or an outside path whose ancestor is a drive root; the regression was
found on a real Windows host and CI now runs the suite there.

### Performance

- `isMultiline` no longer scans to the end of the document per node, which made
compact notebooks quadratic: a 256k-key compact object fell from 6.8 s to
0.76 s.
- `sanitizeTerminal` skips the whole examined window after an unterminated OSC
introducer: 40 MB of `ESC ]` noise fell from 4.1 s to 0.10 s.
- `formatOutputs` bounds a JSON dict before serializing it: 1000 sections of
100k keys fell from 5.6 s to 7 ms and is now constant in the section count.
- The patcher builds its node tree from offsets and parses the value once
natively; array nodes store item spans and materialize only the changed ones.
A one-cell edit in a 17 MB / 64k-cell notebook fell from 1048 ms to roughly
400-550 ms and the patch allocation from ~240 MB to ~43 MB.
- Non-ASCII `ensureAscii` escaping uses a lookup table instead of per-character
concatenation: a 10 MB string fell from 2094 ms / +1992 MB to 485 ms / +282 MB.
- `realpathWithRetry` stops retrying a genuinely absent path: a missing path
fell from 8.9 ms to 0.62 ms, and a new notebook several directories deep is
created in milliseconds.
- `scripts/bench-alloc.ts` pins the per-patch allocation with a fixed workload
(42-44 MB against a 60 MB ceiling and 161-171 MB for the previous tree);
`scripts/bench-writes.ts` asserts time and RSS budgets for a compact notebook,
a large per-cell output, non-ASCII escaping, an object-heavy patch and a
17 MB edit.

### Kernel and Python helper

- A warm-kernel response must echo a per-request nonce: a notebook cell shares
the helper's stdout, so `os.write(1, '{"id":N,...}')` could settle another
request (and `save=true` persisted the forged output). Helpers that do not
advertise the nonce keep working.
- A kernel that dies under nbclient is torn down and the next request starts a
fresh kernel instead of failing until an explicit restart.
- An aborted or timed-out request no longer kills the shared kernel for other
in-flight requests.
- A queued `shutdown` preempts a running cell instead of waiting for it.
- The helper validates `timeoutMs` and `maxOutputChars` and returns a structured
error instead of a traceback and exit 1; a missing `pip` degrades the `env`
report to an empty package list instead of failing it; a serve request that
names a different notebook is refused instead of silently running the init
notebook.
- The helper exits when its parent disappears, so a plugin crash no longer
leaves an orphaned helper and kernel running until the cell ends.
- `MAX_HELPER_STDOUT_BYTES` is compared against UTF-8 bytes, and an aborted
oversized line clears its request timer instead of killing the next request.

### Tooling, proofs and specs

- The silence guard also matches `.catch(() => identifier)` forms; every
deliberately silent site is inventoried in `docs/contributing.md`.
- `scripts-vacuity.sh` ships the non-vacuity probes the guide promises: it
builds a temporary inverse invariant for all 17 checked states and fails when
TLC does not violate it. `scripts-verify.sh` runs it.
- Lean: sortedness is modelled over the UTF-16 unit order the shipped comparator
uses, `MarkdownSafe` records the clamped case and the well-formedness property,
and `NotebookDefaults` states key/value stability rather than only
"present implies noop".
- TLA+: `KernelWarningRing` gained a dishonest twin, and the scope each model
actually covers (win32 replace, `DeliveredBounded`) is stated in the module.
- `prepack` now verifies the packed file set (`server.js`,
`python/ipynb_runner.py`, docs) and greps `dist/index.js` for strings from the
current sources, so a stale or incomplete package cannot ship.
- CI: the test job retries up to three times, annotates every failing test and
uploads every attempt's log; Windows and macOS jobs run the suite.
- The LSP materialized sidecar is not rewritten when its content is unchanged,
preserving its mtime. The diagnostics temp file is still rewritten per call.

### Documentation

- `README`, `CHANGELOG` and `docs/` statements were checked against measured
behavior: the byte-stability claims, the defaulted-key insertion, the sidecar
no-rewrite scope, and the inode check's actual reach.

## 2.0.0

- OpenCode V2-only plugin (`@opencode/plugin` 2.2.2). The V1 `server()` export is removed.
Expand Down
Loading
Loading