v1.4.2 release: live-coding editor — Run Selection, slot release, engine panel, console, manual completion

Additive conveniences to the macOS-only Live Scratch editor. No changes to
existing public API.

- Run Selection (⌘E): evaluate just the highlighted text, additively.
- Graceful slot release: context.release(slot:) / free(slot:).
- Engine panel: live oscilloscope (ScopeCapture) + CPU avg/peak + counts.
- Reset Session / Restart to Reclaim Memory.
- Always-open console panel (report messages + errors with line:col).
- Faster typing: debounced highlight, updateNSView fast-path, publish guards.
- Manual code completion (Esc / F5), no auto-trigger on `.`; completion
  replaces the partial word, not the receiver expression.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 11:09:30 -07:00
parent abc64df4d7
commit 8519cabe42
21 changed files with 1578 additions and 145 deletions
+79
View File
@@ -7,6 +7,85 @@ functionality in a backward-compatible way.
---
## 1.4.2 — Live-coding: Run Selection + graceful slot release
A minor release. Backward-compatible — additive conveniences to the (macOS-only)
live-coding editor that make per-fragment evaluation and voice lifecycle feel
like a proper live-coding environment. No changes to existing public API.
### New — Run Selection (⌘E)
Evaluate just the **highlighted text** and *add* it to whatever is already
playing — always additively, never a replace. It leaves the rest of the buffer
and the whole-buffer re-evaluation baseline (the clean/dirty badge still reflects
your last full run) untouched. This is the live-coding "evaluate this line/region,
keep going" gesture: audition a single voice, layer it in, iterate. Works in both
Swift and Graph DSL modes; no-op with no selection. ⌘↩ / ⌘⇧↩ (whole buffer) are
unchanged.
### New — Start a voice, release it later (`context.release(slot:)`)
Named slots are the persistent **handle** across evaluations — the slot *name* is
your reference (Swift `let`/`var` bindings can't carry from one snippet to the
next, since each ⌘↩/⌘E is a separately-compiled unit). Pair that with Run
Selection to start a voice in one evaluation and let it go in another:
```swift
// ⌘E this line — start a persistent, gated voice named "pad":
context.play(slot: "pad") { EnvGen(gate: 1, /* free-on-done */) * OscSaw.Audio(freq: 110) }
// …later, ⌘E this line — graceful release: the envelope tails out, then frees:
context.release(slot: "pad")
```
- `context.release(slot:)` triggers the voice's envelope **release** phase and
frees the name; the voice self-frees via its done-action (and, as a safety net,
stays reclaimable by **Clear Synths** if it never does).
- `context.free(slot:)` is the **immediate** hard stop — the counterpart, no tail.
### New — Engine panel (scope + status)
A panel at the bottom of the scratch window gives an always-on view of the
running engine: a live dual-channel **oscilloscope** of the output (fed by a
`ScopeCapture` the session attaches to the output buses), plus **CPU
average/peak** meter bars and **synth / group / snippet** counts.
### New — Reset Session + Restart to Reclaim Memory
Two Run-menu commands for the by-design snippet-dylib cost:
- **Reset Session** — an in-process, *non-destructive* reset: stops all snippet
audio, shuts down the code-completion server (freeing its subprocess and temp
files), and clears diagnostics. Your buffer is untouched.
- **Restart to Reclaim Memory…** — relaunches the app (with a confirmation), the
only way to actually free the mapped snippet dylibs, which cannot be unloaded
in-process.
### New — Console panel
An always-open panel down the right side logs everything: snippet
`context.reportMessage(_:)` output (the live-coding `print`), compile / Graph DSL
**errors** with their `line:col`, and a one-line notice per run — oldest first,
auto-scrolled, with a **Clear** button. Errors moved here from the old transient
bottom strip so they stay visible while you fix them.
### Faster typing
Cut the per-keystroke cost in the editor: syntax highlighting is debounced
(coalesced after a brief pause instead of a full-buffer re-tokenize on every
key), `updateNSView` fast-paths a pure text change, and redundant `@Published`
republishes (selection, re-eval state) are elided.
### Changed — code completion is now manual (Esc / F5)
Completion no longer auto-opens on `.`. The auto-trigger ambushed typing — after
`Pan2.` the popup opened and couldn't be dismissed by deleting, trapping the
caret until a candidate was picked. Invoke completion deliberately with **Esc**
(or **F5**); a member request after a dot still resolves. Wider default scratch
window too (75% of the visible screen width).
---
## 1.4.1 — "Learning Swift for Lyrebird" intro guide
A documentation-only release, continuing the doc improvements begun in 1.3. No