@0perator/operator 0.1.158 → 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 +19 -0
- package/dist/tools/registry.js +25 -0
- package/dist/ui/mouse.js +55 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@ 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
|
+
|
|
16
|
+
## 0.1.159 — 2026-09-29 — fix: checkpoint no longer wedges on a stale git index lock
|
|
17
|
+
- **The recurring "checkpoints don't work" bug, root-caused + fixed.** The 0.1.148 SIGKILL-on-timeout
|
|
18
|
+
hardening made checkpoints un-hangable — but a `git` killed mid-add/commit leaves `.git/index.lock`
|
|
19
|
+
orphaned, and git never clears it, so **every subsequent checkpoint** died with `fatal: Unable to create
|
|
20
|
+
'.git/index.lock': File exists` (seen live on JL2, 0.1.151). Now `clearStaleCheckpointLock()` removes the
|
|
21
|
+
lock before committing, but **only when it's older than 30s** — a live add/commit holds it for well under
|
|
22
|
+
a second, so an aged lock is provably orphaned by a prior killed run, while a concurrent op's fresh lock
|
|
23
|
+
is never touched (worktree-safe via `git rev-parse --git-dir`). Real-git test proves both: stale lock
|
|
24
|
+
cleared + commits; fresh lock preserved + the lock error still surfaces. Suite 721 green (+2).
|
|
25
|
+
|
|
7
26
|
## 0.1.158 — 2026-09-29 — fix: TUI capability-detection review findings
|
|
8
27
|
- Adversarial review of the 0.1.156 TUI foundation surfaced real gaps, now fixed: (1) `truecolor` was
|
|
9
28
|
conflated with the graphics-protocol flag, under-detecting VS Code/Warp/Hyper/Tabby — split into an
|
package/dist/tools/registry.js
CHANGED
|
@@ -449,6 +449,27 @@ function checkpointGitEnv() {
|
|
|
449
449
|
async function checkpointGit(gitArgs, cwd, timeout) {
|
|
450
450
|
return pexecFile("git", gitArgs, { cwd, timeout, killSignal: "SIGKILL", env: checkpointGitEnv(), maxBuffer: 16 * 1024 * 1024 });
|
|
451
451
|
}
|
|
452
|
+
// Our own SIGKILL-on-timeout hardening (above) fixed checkpoint HANGS but introduced a failure mode: a
|
|
453
|
+
// `git` killed mid-add/commit leaves its `.git/index.lock` orphaned, and EVERY later checkpoint then dies
|
|
454
|
+
// with "fatal: Unable to create '.git/index.lock': File exists" (seen live on JL2, 0.1.151). git never
|
|
455
|
+
// clears it. So before committing we remove a STALE lock — one older than any live index op could hold
|
|
456
|
+
// (a real add/commit holds it well under a second; a lock this old is orphaned by a prior killed run).
|
|
457
|
+
// Age-gated so a concurrent legit git op's fresh lock is never touched. Best-effort: any error → proceed.
|
|
458
|
+
const STALE_LOCK_MS = 30_000;
|
|
459
|
+
async function clearStaleCheckpointLock(workspace) {
|
|
460
|
+
try {
|
|
461
|
+
const gitDir = (await checkpointGit(["rev-parse", "--git-dir"], workspace, 10_000)).stdout.trim();
|
|
462
|
+
if (!gitDir)
|
|
463
|
+
return;
|
|
464
|
+
const { isAbsolute, join } = (await nodeImport("node:path"));
|
|
465
|
+
const lock = join(isAbsolute(gitDir) ? gitDir : join(workspace, gitDir), "index.lock");
|
|
466
|
+
const fs = (await nodeImport("node:fs/promises"));
|
|
467
|
+
const st = await fs.stat(lock).catch(() => null);
|
|
468
|
+
if (st && Date.now() - st.mtimeMs > STALE_LOCK_MS)
|
|
469
|
+
await fs.unlink(lock).catch(() => { });
|
|
470
|
+
}
|
|
471
|
+
catch { /* best-effort — if this fails the checkpoint just proceeds and may error as before */ }
|
|
472
|
+
}
|
|
452
473
|
// checkpoint = git add+commit in workspace + a memory note, one call (SPEC §8). Never adds
|
|
453
474
|
// Co-Authored-By / AI attribution — the commit message is exactly the caller's summary.
|
|
454
475
|
async function checkpoint(args) {
|
|
@@ -470,6 +491,10 @@ async function checkpoint(args) {
|
|
|
470
491
|
await checkpointGit(["init"], workspace, 10_000);
|
|
471
492
|
initialized = true;
|
|
472
493
|
}
|
|
494
|
+
else {
|
|
495
|
+
// Clear a lock orphaned by a PRIOR killed checkpoint before it dooms this one (see helper above).
|
|
496
|
+
await clearStaleCheckpointLock(workspace);
|
|
497
|
+
}
|
|
473
498
|
await checkpointGit(["add", "-A"], workspace, 120_000);
|
|
474
499
|
try {
|
|
475
500
|
await checkpointGit(["commit", "--no-verify", "-m", summary], workspace, 60_000);
|
package/dist/ui/mouse.js
ADDED
|
@@ -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.
|
|
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": {
|