@0perator/operator 0.1.155 → 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 +13 -0
- package/dist/cli.js +7 -0
- 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,19 @@ 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
|
+
|
|
7
20
|
## 0.1.155 — 2026-09-29 — sandbox: Linux bubblewrap parity (sandboxed-exec Phase 2)
|
|
8
21
|
- `KODE_SANDBOX=workspace|strict` now sandboxes shell execution on **Linux** (bubblewrap), not just macOS
|
|
9
22
|
(seatbelt). `hasSandboxExec()` is darwin-only, so on the Linux fleet (jl2/jl3/AXeServer/droplets)
|
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)
|
|
@@ -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": {
|