@0perator/operator 0.1.154 → 0.1.156
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 +27 -0
- package/dist/cli.js +7 -0
- package/dist/tools/sandbox.js +59 -4
- package/dist/ui/capabilities.js +59 -0
- package/dist/ui/osc.js +25 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,33 @@ 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.156 — 2026-09-29 — TUI: terminal capability detection + artifact links (upgrade Phase 0+2)
|
|
8
|
+
- First increment of an enterprise-TUI upgrade (7-agent SOTA research → blueprint in
|
|
9
|
+
`_ai-docs/architecture/tui-enterprise-upgrade.md`). New `src/ui/capabilities.ts` (pure, cached-at-boot):
|
|
10
|
+
fingerprints the terminal (`TERM_PROGRAM`/`TERM`/`COLORTERM`) into `{isTTY, osc8, truecolor, mouse,
|
|
11
|
+
graphics, tmux, termName}`, and `hyperlinkHint()` tells the owner when their terminal (Terminal.app,
|
|
12
|
+
Alacritty) can't render clickable links — iTerm2/Ghostty/Kitty/WezTerm can. `osc.ts` `link()` gains an
|
|
13
|
+
optional OSC 8 `id=` param (redraw-stable underlining across Ink repaints) + `artifactLink(label,url)`
|
|
14
|
+
(URL-stable id) so Operator can **place clickable artifact links**; the existing `hyperlinksEnabled`/
|
|
15
|
+
`link`/`fileLink` contract is unchanged. `cli.tsx` prints the hint once (dim, inline-only) after the
|
|
16
|
+
masthead. Clickable URLs/paths already worked in OSC-8 terminals; this adds detection + the artifact
|
|
17
|
+
primitive + a nudge for unsupported terminals. **Next:** Phase 1 mouse layer, Phase 3 file/diff panels.
|
|
18
|
+
Suite 712 green (+9).
|
|
19
|
+
|
|
20
|
+
## 0.1.155 — 2026-09-29 — sandbox: Linux bubblewrap parity (sandboxed-exec Phase 2)
|
|
21
|
+
- `KODE_SANDBOX=workspace|strict` now sandboxes shell execution on **Linux** (bubblewrap), not just macOS
|
|
22
|
+
(seatbelt). `hasSandboxExec()` is darwin-only, so on the Linux fleet (jl2/jl3/AXeServer/droplets)
|
|
23
|
+
`wrapShell` fell through to plain bash — the modes were a **silent no-op** there. New `hasBubblewrap()`
|
|
24
|
+
(Linux-only) + `bwrapArgs(mode)` map the SAME `DENY_WRITE`/`SECRET_READ` lists + allow-roots to bwrap
|
|
25
|
+
bind-mount namespaces (protected paths → `--ro-bind`, secrets → `--tmpfs`/`/dev/null` mask, strict →
|
|
26
|
+
whole-FS `--ro-bind / /` + writable allow-roots + `--unshare-net`). `wrapShell`/`wrapInteractiveShell`
|
|
27
|
+
try seatbelt → bwrap → plain bash; **macOS behavior unchanged** (seatbelt still wins). Absent on thin
|
|
28
|
+
images (Alpine) → falls back to plain bash, JS write-guards still apply. **Runtime-validated on a real
|
|
29
|
+
Linux node** (Ubuntu 24.04, bubblewrap 0.9.0, canary-only, pkg purged): strict masks secret reads + cuts
|
|
30
|
+
network + confines writes; workspace allows network but keeps secret masking + protected-path read-only.
|
|
31
|
+
Design + validation: `_ai-docs/architecture/sandboxed-code-execution.md`; decision:
|
|
32
|
+
`_ai-docs/decisions/2026-09-29-linux-bubblewrap.md`. Suite 703 green (+4).
|
|
33
|
+
|
|
7
34
|
## 0.1.154 — 2026-09-29 — engine: per-session persistent shell (sandboxed-exec Phase 1)
|
|
8
35
|
- The `bash`/`shell_exec` persistent shell is now **per session**, not one process-wide singleton. Before, the
|
|
9
36
|
foreground and every background sub-agent shared ONE bash: a sub-agent's `cd`/`export` corrupted the
|
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
8
8
|
import { render, Box, Text, useApp } from "ink";
|
|
9
9
|
import { App } from "./ui/index.js";
|
|
10
10
|
import { mastheadLines } from "./ui/Masthead.js";
|
|
11
|
+
import { hyperlinkHint } from "./ui/capabilities.js";
|
|
11
12
|
import { shouldPromptPlanExit, resolvePlanExit, PLAN_EXIT_OPTIONS } from "./ui/planExit.js";
|
|
12
13
|
import { RemoteHost } from "./remote/host.js";
|
|
13
14
|
import { isErrorResult } from "./ui/format.js";
|
|
@@ -1566,6 +1567,12 @@ if (FULLSCREEN) {
|
|
|
1566
1567
|
}
|
|
1567
1568
|
else {
|
|
1568
1569
|
process.stdout.write(mastheadLines(`300K · v${VERSION}`).join("\n") + "\n");
|
|
1570
|
+
// One-time hint when the terminal can't render clickable links, so the owner knows a supporting
|
|
1571
|
+
// terminal (iTerm2/Ghostty/Kitty/WezTerm) makes URLs + artifact links clickable. Empty (skipped) when
|
|
1572
|
+
// links already work. Dim, single line, inline-only — never mid-stream.
|
|
1573
|
+
const linkHint = hyperlinkHint();
|
|
1574
|
+
if (linkHint)
|
|
1575
|
+
process.stdout.write(`\x1b[2m tip: ${linkHint}\x1b[22m\n`);
|
|
1569
1576
|
}
|
|
1570
1577
|
const inkInstance = render(_jsx(Root, {}));
|
|
1571
1578
|
if (FULLSCREEN)
|
package/dist/tools/sandbox.js
CHANGED
|
@@ -179,6 +179,40 @@ export function seatbeltProfile(mode) {
|
|
|
179
179
|
}
|
|
180
180
|
return `(version 1)(allow default)(deny file-write* ${denySub} ${denyFiles})${denyRead}`;
|
|
181
181
|
}
|
|
182
|
+
/** Bubblewrap (bwrap) argv enforcing the SAME intent as seatbeltProfile(), for the Linux fleet where
|
|
183
|
+
* macOS sandbox-exec doesn't exist — hasSandboxExec() hardcodes false off-darwin, so KODE_SANDBOX=
|
|
184
|
+
* workspace|strict was a silent no-op on Linux (jl2/jl3/AXeServer) until this. bwrap is namespace /
|
|
185
|
+
* bind-mount based, not a rule profile, so the same denylists map to mounts (bwrap applies them
|
|
186
|
+
* left-to-right, later wins): protected write-paths are re-bound read-only, secret paths are masked
|
|
187
|
+
* (empty tmpfs / /dev/null so reads can't exfil), and strict makes the whole FS read-only except the
|
|
188
|
+
* allow-roots and cuts the network. Returns the args BEFORE the `/bin/bash …` argv. Exported for unit
|
|
189
|
+
* tests. NOTE: kernel enforcement must be validated on a real Linux node — untestable on macOS/JL1. */
|
|
190
|
+
export function bwrapArgs(mode) {
|
|
191
|
+
const a = [];
|
|
192
|
+
if (mode === "strict") {
|
|
193
|
+
a.push("--ro-bind", "/", "/"); // whole FS read-only …
|
|
194
|
+
a.push("--proc", "/proc", "--dev", "/dev");
|
|
195
|
+
for (const root of allowedWriteRoots())
|
|
196
|
+
a.push("--bind-try", root, root); // … except the allow-roots
|
|
197
|
+
a.push("--unshare-net"); // strict: no network
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
a.push("--bind", "/", "/"); // workspace: FS writable …
|
|
201
|
+
a.push("--proc", "/proc", "--dev", "/dev");
|
|
202
|
+
for (const d of DENY_WRITE_SUBPATHS)
|
|
203
|
+
a.push("--ro-bind-try", resolve(d), resolve(d)); // … protected dirs read-only
|
|
204
|
+
for (const f of DENY_WRITE_FILES)
|
|
205
|
+
a.push("--ro-bind-try", "/dev/null", resolve(f)); // protected files masked
|
|
206
|
+
}
|
|
207
|
+
// Read-containment (BOTH modes): mask secret dirs with an empty tmpfs, secret files with /dev/null,
|
|
208
|
+
// so a shell command can't read + exfil credentials. Placed last so it wins over the writable binds.
|
|
209
|
+
for (const d of SECRET_READ_SUBPATHS)
|
|
210
|
+
a.push("--tmpfs", resolve(d));
|
|
211
|
+
for (const f of SECRET_READ_FILES)
|
|
212
|
+
a.push("--ro-bind", "/dev/null", resolve(f));
|
|
213
|
+
a.push("--die-with-parent");
|
|
214
|
+
return a;
|
|
215
|
+
}
|
|
182
216
|
let _sbExec = null; // cache: is sandbox-exec present on this host?
|
|
183
217
|
async function hasSandboxExec() {
|
|
184
218
|
if (_sbExec !== null)
|
|
@@ -194,13 +228,31 @@ async function hasSandboxExec() {
|
|
|
194
228
|
return (_sbExec = false);
|
|
195
229
|
}
|
|
196
230
|
}
|
|
231
|
+
let _bwrap = null; // cache: is bubblewrap (bwrap) present on this Linux host?
|
|
232
|
+
async function hasBubblewrap() {
|
|
233
|
+
if (_bwrap !== null)
|
|
234
|
+
return _bwrap;
|
|
235
|
+
if (process.platform !== "linux")
|
|
236
|
+
return (_bwrap = false); // Linux-only; macOS uses sandbox-exec above
|
|
237
|
+
try {
|
|
238
|
+
const { execFile } = await import("node:child_process");
|
|
239
|
+
await new Promise((res, rej) => execFile("bwrap", ["--version"], (e) => (e ? rej(e) : res())));
|
|
240
|
+
return (_bwrap = true);
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
return (_bwrap = false); // absent (e.g. Alpine/thin images) → fall back to plain bash; JS guards still apply
|
|
244
|
+
}
|
|
245
|
+
}
|
|
197
246
|
/** Wrap a shell command for `execFile` under the OS sandbox. Returns the argv to run: under an active
|
|
198
247
|
* sandbox on macOS it's `sandbox-exec -p <profile> /bin/bash -c <command>`; otherwise the plain bash
|
|
199
248
|
* invocation (the JS write-guards still protect the file tools). */
|
|
200
249
|
export async function wrapShell(command) {
|
|
201
250
|
const mode = sandboxMode();
|
|
202
|
-
if (mode !== "off"
|
|
203
|
-
|
|
251
|
+
if (mode !== "off") {
|
|
252
|
+
if (await hasSandboxExec())
|
|
253
|
+
return { file: "/usr/bin/sandbox-exec", args: ["-p", seatbeltProfile(mode), "/bin/bash", "-c", command] };
|
|
254
|
+
if (await hasBubblewrap())
|
|
255
|
+
return { file: "bwrap", args: [...bwrapArgs(mode), "/bin/bash", "-c", command] };
|
|
204
256
|
}
|
|
205
257
|
return { file: "/bin/bash", args: ["-c", command] };
|
|
206
258
|
}
|
|
@@ -210,8 +262,11 @@ export async function wrapShell(command) {
|
|
|
210
262
|
* noise; the session drives framing itself with a sentinel. */
|
|
211
263
|
export async function wrapInteractiveShell() {
|
|
212
264
|
const mode = sandboxMode();
|
|
213
|
-
if (mode !== "off"
|
|
214
|
-
|
|
265
|
+
if (mode !== "off") {
|
|
266
|
+
if (await hasSandboxExec())
|
|
267
|
+
return { file: "/usr/bin/sandbox-exec", args: ["-p", seatbeltProfile(mode), "/bin/bash", "-s"] };
|
|
268
|
+
if (await hasBubblewrap())
|
|
269
|
+
return { file: "bwrap", args: [...bwrapArgs(mode), "/bin/bash", "-s"] };
|
|
215
270
|
}
|
|
216
271
|
return { file: "/bin/bash", args: ["-s"] };
|
|
217
272
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Terminal capability detection (Phase 0 of the enterprise-TUI upgrade — see
|
|
2
|
+
// _ai-docs/architecture/tui-enterprise-upgrade.md). Pure + cached-once-at-boot, same discipline as
|
|
3
|
+
// osc.ts/term.ts (no Ink, no side effects) so it's safe in the neutral bundle and unit-testable.
|
|
4
|
+
//
|
|
5
|
+
// We sniff env only (no terminal round-trips / DA queries): TERM_PROGRAM identifies the emulator,
|
|
6
|
+
// TERM/COLORTERM fill the gaps. Detection is deliberately conservative — a false "supported" makes a
|
|
7
|
+
// feature misbehave, a false "unsupported" only forgoes a nicety. OSC 8 hyperlinks in particular
|
|
8
|
+
// DEGRADE safely everywhere (osc.ts already emits them; an unsupporting terminal shows the label), so
|
|
9
|
+
// `osc8` here drives HINTS/affordances, not whether links are emitted.
|
|
10
|
+
// Known emulators keyed by the lowercased TERM_PROGRAM value, with a display name and whether they
|
|
11
|
+
// honor OSC 8 clicks. Apple_Terminal is the notable OSC-8 holdout among common macOS terminals.
|
|
12
|
+
const KNOWN = {
|
|
13
|
+
"iterm.app": { name: "iTerm2", osc8: true, graphics: true },
|
|
14
|
+
"apple_terminal": { name: "Terminal.app", osc8: false, graphics: false },
|
|
15
|
+
"ghostty": { name: "Ghostty", osc8: true, graphics: true },
|
|
16
|
+
"wezterm": { name: "WezTerm", osc8: true, graphics: true },
|
|
17
|
+
"vscode": { name: "VS Code", osc8: true, graphics: false },
|
|
18
|
+
"hyper": { name: "Hyper", osc8: true, graphics: false },
|
|
19
|
+
"tabby": { name: "Tabby", osc8: true, graphics: false },
|
|
20
|
+
"rio": { name: "Rio", osc8: true, graphics: true },
|
|
21
|
+
"warpterminal": { name: "Warp", osc8: true, graphics: false },
|
|
22
|
+
"alacritty": { name: "Alacritty", osc8: false, graphics: false }, // OSC 8 landed only very recently; treat as no
|
|
23
|
+
};
|
|
24
|
+
/** Pure detection from an explicit env + TTY flag. Exported for unit tests; production reads via caps(). */
|
|
25
|
+
export function detectCaps(env, isTTY) {
|
|
26
|
+
const tp = (env.TERM_PROGRAM ?? "").toLowerCase();
|
|
27
|
+
const term = (env.TERM ?? "").toLowerCase();
|
|
28
|
+
const colorterm = (env.COLORTERM ?? "").toLowerCase();
|
|
29
|
+
const tmux = !!env.TMUX || term.startsWith("tmux") || term.startsWith("screen");
|
|
30
|
+
const known = KNOWN[tp];
|
|
31
|
+
// Kitty advertises itself via TERM=xterm-kitty rather than TERM_PROGRAM.
|
|
32
|
+
const isKitty = term === "xterm-kitty" || tp === "kitty";
|
|
33
|
+
const name = known?.name ?? (isKitty ? "Kitty" : tp || term || "terminal");
|
|
34
|
+
// OSC 8: a known-supporting emulator, or Kitty. Unknown terminals → false for HINTS only (links are
|
|
35
|
+
// still emitted by osc.ts and degrade to the label). Non-TTY is never "supported".
|
|
36
|
+
const osc8 = isTTY && (known?.osc8 ?? isKitty ?? false) === true;
|
|
37
|
+
const truecolor = isTTY && (colorterm === "truecolor" || colorterm === "24bit" || isKitty || known?.graphics === true);
|
|
38
|
+
// SGR mouse reporting is universal on modern terminals; the only real exclusions are non-TTY and
|
|
39
|
+
// the legacy dumb terminal. We stay permissive here and gate mouse USE on `fullscreen` + this flag.
|
|
40
|
+
const mouse = isTTY && term !== "dumb" && term !== "";
|
|
41
|
+
const graphics = isTTY && (isKitty || known?.graphics === true);
|
|
42
|
+
return { isTTY, termProgram: tp, termName: name, osc8, truecolor, mouse, graphics, tmux };
|
|
43
|
+
}
|
|
44
|
+
let _caps = null;
|
|
45
|
+
/** The active terminal's capabilities, detected once from process.env at first call and cached.
|
|
46
|
+
* Tests call detectCaps(env, isTTY) directly instead of poking process.env. */
|
|
47
|
+
export function caps() {
|
|
48
|
+
if (!_caps)
|
|
49
|
+
_caps = detectCaps(process.env, !!process.stdout.isTTY);
|
|
50
|
+
return _caps;
|
|
51
|
+
}
|
|
52
|
+
/** One-line hint when the current terminal won't render clickable links — so the owner knows switching
|
|
53
|
+
* to iTerm2/Ghostty/Kitty/WezTerm makes URLs + artifact links clickable. Empty string when links work
|
|
54
|
+
* (or output isn't a TTY). Shown once at boot by the CLI, never mid-stream. */
|
|
55
|
+
export function hyperlinkHint(c = caps()) {
|
|
56
|
+
if (!c.isTTY || c.osc8)
|
|
57
|
+
return "";
|
|
58
|
+
return `links aren't clickable in ${c.termName} — iTerm2, Ghostty, Kitty or WezTerm make URLs + artifact links clickable`;
|
|
59
|
+
}
|
package/dist/ui/osc.js
CHANGED
|
@@ -5,14 +5,36 @@
|
|
|
5
5
|
import { resolve, isAbsolute } from "node:path";
|
|
6
6
|
const OPEN = "\x1b]8;;"; // OSC 8 ; params ; URI — params empty
|
|
7
7
|
const ST = "\x1b\\"; // string terminator
|
|
8
|
+
/** Tiny stable id (FNV-1a hash, base36) for an OSC 8 `id=` param — so a link that wraps across lines or
|
|
9
|
+
* is redrawn in pieces (Ink repaints partial screens) is treated by the terminal as ONE hyperlink, with
|
|
10
|
+
* continuous underline + a single hover target. Deterministic, no deps. */
|
|
11
|
+
function linkId(seed) {
|
|
12
|
+
let h = 0x811c9dc5;
|
|
13
|
+
for (let i = 0; i < seed.length; i++) {
|
|
14
|
+
h ^= seed.charCodeAt(i);
|
|
15
|
+
h = Math.imul(h, 0x01000193);
|
|
16
|
+
}
|
|
17
|
+
return (h >>> 0).toString(36);
|
|
18
|
+
}
|
|
8
19
|
/** True when we should emit hyperlink escapes: a real TTY, not explicitly disabled. Non-TTY (piped/
|
|
9
20
|
* headless) output must stay plain so captured logs aren't polluted with escapes. */
|
|
10
21
|
export function hyperlinksEnabled() {
|
|
11
22
|
return process.env.KODE_NO_HYPERLINKS !== "1" && !!process.stdout.isTTY;
|
|
12
23
|
}
|
|
13
|
-
/** Wrap `label` as a clickable hyperlink to `url
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
/** Wrap `label` as a clickable hyperlink to `url`. Optional `id` sets the OSC 8 `id=` param so a link
|
|
25
|
+
* split across lines/redraws stays one hyperlink. Format: `OSC 8 ; [id=<id>] ; url ST label OSC 8 ;; ST`. */
|
|
26
|
+
export function link(label, url, id) {
|
|
27
|
+
const open = id ? `\x1b]8;id=${id};${url}${ST}` : `${OPEN}${url}${ST}`;
|
|
28
|
+
return `${open}${label}${OPEN}${ST}`;
|
|
29
|
+
}
|
|
30
|
+
/** Render an artifact reference (a report, built file, deployed URL, hosted artifact…) as a clickable
|
|
31
|
+
* link. Uses a URL-stable `id=` so the same artifact reads as one hyperlink even when Ink repaints it
|
|
32
|
+
* in pieces. No-op label passthrough when hyperlinks are disabled (non-TTY / KODE_NO_HYPERLINKS). The
|
|
33
|
+
* visual affordance (icon/color) is the caller's Ink <Text>; this only does the OSC 8 wrapping. */
|
|
34
|
+
export function artifactLink(label, url) {
|
|
35
|
+
if (!hyperlinksEnabled())
|
|
36
|
+
return label;
|
|
37
|
+
return link(label, url, linkId(url));
|
|
16
38
|
}
|
|
17
39
|
/** Linkify a value that looks like a file path or an http(s) URL; return it unchanged otherwise. A
|
|
18
40
|
* `path:line[:col]` suffix stays in the visible label but is stripped from the file:// target. No-op
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0perator/operator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.156",
|
|
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": {
|