@0perator/operator 0.1.159 → 0.1.160

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/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@ Operator is AXE's terminal coding agent (npm `@0perator/operator`), running on A
4
4
  Newest first. Every release bumps `src/cli.tsx` VERSION + `package.json`, adds an entry here, and ships to
5
5
  npm + both git remotes (memjar/kode, axetechnologies/kode). Test counts are the full suite at that release.
6
6
 
7
+ ## 0.1.160 — 2026-09-30 — TUI: SGR mouse parser (Phase 1 foundation) + Aurora speed plan
8
+ - New `src/ui/mouse.ts`: a pure SGR (mode 1006) mouse-sequence parser (`CSI < Cb;Cx;Cy M/m`) decoding
9
+ press/release/drag/move/wheel + shift/alt/ctrl, plus `MOUSE_ON`/`MOUSE_OFF` (mode 1002 button-event +
10
+ 1006, never 1003 any-event). The foundation the `MouseProvider` (next increment) feeds stdin to and
11
+ hit-tests against Ink `measureElement` bounds, fullscreen-only. Pure, 9 tests. Also lands the Aurora
12
+ speed-amplification plan (7-agent research): ngram-mod MoE draft-length fix (n 3/8→24/64, a verified
13
+ live misconfig) + `--backend-sampling` applied to the serve plist; EAGLE3/MTP ruled out (broken for
14
+ qwen35moe / net-loss on Metal). Suite 730 green (+9).
15
+
7
16
  ## 0.1.159 — 2026-09-29 — fix: checkpoint no longer wedges on a stale git index lock
8
17
  - **The recurring "checkpoints don't work" bug, root-caused + fixed.** The 0.1.148 SIGKILL-on-timeout
9
18
  hardening made checkpoints un-hangable — but a `git` killed mid-add/commit leaves `.git/index.lock`
@@ -0,0 +1,55 @@
1
+ // Pure SGR (mode 1006) mouse-sequence parser — the foundation of the Phase 1 mouse layer
2
+ // (fullscreen-only; blueprint: _ai-docs/architecture/tui-enterprise-upgrade.md). Ink has no mouse API,
3
+ // so MouseProvider (next increment) enables tracking, feeds raw stdin chunks to parseMouse(), and
4
+ // dispatches the normalized events to hit-tested regions (Ink measureElement bounds). This module is
5
+ // pure string→events (no Ink/node deps), unit-tested like osc.ts/capabilities.ts.
6
+ //
7
+ // Only SGR is parsed — `CSI < Cb ; Cx ; Cy (M|m)` — the one modern-terminal encoding (every terminal in
8
+ // the vtdn.dev matrix): decimal coords with no 223-column ceiling and an unambiguous press/release via
9
+ // the final M/m. Legacy X10/1000, urxvt/1015 and UTF-8/1005 are never emitted, so never parsed.
10
+ // CSI < Cb ; Cx ; Cy M|m — global so we can walk every event in a chunk.
11
+ const SGR = /\x1b\[<(\d+);(\d+);(\d+)([Mm])/g;
12
+ /** Parse every SGR mouse event in a stdin chunk, in order. Non-mouse bytes (keyboard) are ignored — the
13
+ * caller routes those to Ink's own input. Decodes Cb: low 2 bits = button (0 left / 1 middle / 2 right),
14
+ * +4 shift, +8 alt, +16 ctrl, +32 motion-while-held, +64 wheel (65 = wheel down, 64 = wheel up). */
15
+ export function parseMouse(chunk) {
16
+ const out = [];
17
+ SGR.lastIndex = 0;
18
+ let m;
19
+ while ((m = SGR.exec(chunk)) !== null) {
20
+ const cb = Number(m[1]);
21
+ const x = Number(m[2]);
22
+ const y = Number(m[3]);
23
+ const released = m[4] === "m";
24
+ const shift = (cb & 4) !== 0;
25
+ const alt = (cb & 8) !== 0;
26
+ const ctrl = (cb & 16) !== 0;
27
+ let button;
28
+ let action;
29
+ if ((cb & 64) !== 0) {
30
+ // wheel: 64 = up, 65 = down (low bit distinguishes); no button, never a release.
31
+ button = "none";
32
+ action = (cb & 1) !== 0 ? "wheel-down" : "wheel-up";
33
+ }
34
+ else {
35
+ const low = cb & 3;
36
+ button = low === 0 ? "left" : low === 1 ? "middle" : low === 2 ? "right" : "none";
37
+ if (released)
38
+ action = "release";
39
+ else if ((cb & 32) !== 0)
40
+ action = button === "none" ? "move" : "drag";
41
+ else
42
+ action = "press";
43
+ }
44
+ out.push({ x, y, button, action, shift, alt, ctrl });
45
+ }
46
+ return out;
47
+ }
48
+ // Enable/disable SGR mouse tracking. Mode 1002 (button-event) = press + release + drag-while-held + wheel
49
+ // — the practical default for a scrollable/clickable TUI; NEVER 1003 (any-event floods stdin on every
50
+ // move). Paired with 1006 (SGR encoding). Written to stdout ONLY in fullscreen (inline keeps the
51
+ // terminal's native scroll + copy). MOUSE_OFF must run in a try/finally + on exit/SIGINT/SIGTERM/
52
+ // uncaughtException — a tracking mode left enabled after a crash captures every click until a manual
53
+ // reset (the single most common real-world mouse bug across every project surveyed).
54
+ export const MOUSE_ON = "\x1b[?1002h\x1b[?1006h";
55
+ export const MOUSE_OFF = "\x1b[?1006l\x1b[?1002l";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.159",
3
+ "version": "0.1.160",
4
4
  "description": "Operator (KODE) — TypeScript + Ink terminal coding agent. Full-frame render, single-engine core shared across CLI/web/mobile; runs against a local Aurora model.",
5
5
  "type": "module",
6
6
  "bin": {