@0perator/operator 0.1.55 → 0.1.57

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,22 @@ Operator is AXE's terminal coding agent (npm `@0perator/operator`), running on t
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.57 — 2026-09-22
8
+ - **ReportLab PDF tools ship STANDARD.** report-mcp (build_pdf_report, build_pdf_from_markdown) is now
9
+ always injected — Operator can generate PDFs out of the box without opting into the full MCP fleet
10
+ (`settings.mcp`). New STANDARD_MCP_SERVERS list + loadStandardServers(); the standard hub merges with
11
+ the chauffeur embodiment hub when computer control is on. When the full fleet is enabled, report-mcp is
12
+ already in it, so no double-wire.
13
+ - Tests: 365/365.
14
+
15
+ ## 0.1.56 — 2026-09-22
16
+ - **Shift+Tab cycles the operating mode (Claude-Code parity).** AUTO (execute without asking) → MANUAL
17
+ (approve mutating tools via the gated policy + approve bridge) → PLAN (read-only research + a proposed
18
+ plan, nothing runs) → AUTO. A persistent dim hint under the input shows the current mode, and each
19
+ switch prints a one-line confirmation. Maps to the mobile Manual/Auto/Plan selector. New Session API:
20
+ setPermissionMode() rebuilds the policy at runtime (preserving tier + rules); plan mode was already native.
21
+ - Tests: 365/365.
22
+
7
23
  ## 0.1.55 — 2026-09-22
8
24
  - **Remote-engine auth — Operator now runs against a REMOTE engine.** The model call sent no
9
25
  Authorization header, so it only worked against a local `:8097`; a thin client pointed at the
package/dist/cli.js CHANGED
@@ -24,7 +24,7 @@ import { homedir, hostname } from "node:os";
24
24
  import { createHash } from "node:crypto";
25
25
  // RELEASE CHECKLIST (every bump): update this + package.json "version", ADD A CHANGELOG.md ENTRY
26
26
  // (improvements / fixes / tests), run the suite, then publish to npm + push both remotes.
27
- const VERSION = "0.1.55";
27
+ const VERSION = "0.1.57";
28
28
  // operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
29
29
  const settings = loadSettings();
30
30
  // Propagate the resolved sandbox mode to the tool layer (registry reads KODE_SANDBOX at exec time).
@@ -72,29 +72,38 @@ catch { /* auth is optional — a local engine needs none */ }
72
72
  // mobile bundle never sees these tools.
73
73
  let computerAskRules = {};
74
74
  let computerDenyRules = {};
75
- let embodimentHub; // chauffeur, scoped to embodiment
75
+ let embodimentHub; // injected hub: STANDARD servers + chauffeur
76
+ let chauffeurServer; // set when embodiment is on & fleet off
76
77
  if (settings.computer.enabled) {
77
78
  const { COMPUTER_TOOLS, COMPUTER_TOOL_NAMES, setComputerEnabled } = await import("./tools/computer.js");
78
79
  const { registry } = await import("./tools/registry.js");
79
80
  setComputerEnabled(true);
80
81
  for (const t of COMPUTER_TOOLS)
81
82
  registry.set(t.name, t);
82
- // Embodiment also wires chauffeur (robust textual-AX computer use) when installed, as its OWN curated
83
- // hub — not the whole fleet MCP surface. It fills osascript's blind spot: reading a modern/Electron UI.
84
- // When the owner has opted into the full fleet (settings.mcp), chauffeur is already reachable there, so
85
- // we don't double-wire; otherwise we inject the scoped hub so embodiment alone is enough.
86
- const { buildChauffeurHub, CHAUFFEUR_ACTION_NAMES, CHAUFFEUR_TOOL_NAMES } = await import("./tools/chauffeur.js");
83
+ // Embodiment also wires chauffeur (robust textual-AX computer use) when installed. When the owner has
84
+ // opted into the full fleet (settings.mcp), chauffeur is already reachable there, so we don't double-wire;
85
+ // otherwise we collect its server config to join the standard injected hub below.
86
+ const { buildChauffeurServer, CHAUFFEUR_ACTION_NAMES, CHAUFFEUR_TOOL_NAMES } = await import("./tools/chauffeur.js");
87
87
  if (!settings.mcp)
88
- embodimentHub = (await buildChauffeurHub()) ?? undefined;
88
+ chauffeurServer = (await buildChauffeurServer()) ?? undefined;
89
89
  // Foreground: computer_* and chauffeur ACTIONS prompt ("ask"); chauffeur READS (list_windows,
90
90
  // get_window_state, …) are intentionally NOT gated, so the model reads the screen freely and completes
91
91
  // a task end-to-end without walking the owner through each step. Only real input/mutation asks.
92
- const askNames = [...COMPUTER_TOOL_NAMES, ...(embodimentHub ? CHAUFFEUR_ACTION_NAMES : [])];
92
+ const askNames = [...COMPUTER_TOOL_NAMES, ...(chauffeurServer ? CHAUFFEUR_ACTION_NAMES : [])];
93
93
  computerAskRules = Object.fromEntries(askNames.map((n) => [n, "ask"]));
94
94
  // Background sub-agents have no approver, so DENY every embodiment tool, reads included.
95
- const denyNames = [...COMPUTER_TOOL_NAMES, ...(embodimentHub ? CHAUFFEUR_TOOL_NAMES : [])];
95
+ const denyNames = [...COMPUTER_TOOL_NAMES, ...(chauffeurServer ? CHAUFFEUR_TOOL_NAMES : [])];
96
96
  computerDenyRules = Object.fromEntries(denyNames.map((n) => [n, "deny"]));
97
97
  }
98
+ // STANDARD MCP: report-mcp (PDF tools) ships with Operator — always injected, even without the full-fleet
99
+ // `mcp` setting, so a bare Operator can build PDFs out of the box. When the fleet IS on it's already in the
100
+ // config, so we only inject standalone when the fleet is off. Chauffeur (if collected) joins the same hub.
101
+ if (!settings.mcp) {
102
+ const { loadStandardServers, McpHub } = await import("./mcp/index.js");
103
+ const servers = [...(await loadStandardServers()), ...(chauffeurServer ? [chauffeurServer] : [])];
104
+ if (servers.length)
105
+ embodimentHub = new McpHub(servers);
106
+ }
98
107
  // Foreground policy = the owner's settings with computer tools forced to "ask". When computer control is
99
108
  // off, computerAskRules is empty, so this is behaviorally identical to settings.permissions (an empty
100
109
  // rules object keeps a "bypass" policy inert — zero overhead).
@@ -176,7 +185,7 @@ function loadHandoff() {
176
185
  // with chauffeur's textual accessibility tree instead of hand-rolling osascript — the exact loop that
177
186
  // failed on Slack (AppleScript can't read Electron UIs). chauffeur is reachable either via the scoped
178
187
  // embodiment hub or the full fleet MCP.
179
- const chauffeurReady = !!embodimentHub || settings.mcp;
188
+ const chauffeurReady = !!chauffeurServer || settings.mcp;
180
189
  const EMBODIMENT_GUIDE = settings.computer.enabled
181
190
  ? `\n## Controlling this computer\nComputer control is ON (every action asks the owner first). Drive apps with ` +
182
191
  `computer_app_open / computer_app_activate, computer_type, computer_key, computer_click, computer_screenshot.` +
@@ -320,6 +329,9 @@ function Root() {
320
329
  const [bgAgents, setBgAgents] = useState([]);
321
330
  const [authUser, setAuthUser] = useState(""); // signed-in identity for the status rule
322
331
  const [planMode, setPlanMode] = useState(false); // /plan: read-only research + propose, shown as a status badge
332
+ // Operating mode, cycled with Shift+Tab (like Claude Code): auto (no gate) → manual (approve mutations)
333
+ // → plan (read-only + propose) → auto. Auto=bypass policy, Manual=gated policy, Plan=session plan mode.
334
+ const [opMode, setOpMode] = useState(settings.permissions.mode === "gated" ? "manual" : "auto");
323
335
  const [thinkMode, setThinkMode] = useState("off"); // /think, /ultrathink badge
324
336
  const [elapsed, setElapsed] = useState(0); // live seconds since the current turn started (ticked by a
325
337
  const turnStartRef = useRef(0); // timer, so the clock advances even during a long reasoning
@@ -1006,6 +1018,25 @@ function Root() {
1006
1018
  }, [sendTurn, handleSlash]);
1007
1019
  submitRef.current = onSubmit;
1008
1020
  const onQueue = useCallback((text) => { queued.current = queued.current ? `${queued.current}\n${text}` : text; }, []);
1021
+ // Shift+Tab cycles the operating mode (Claude-Code parity). auto→manual→plan→auto. Auto drives with
1022
+ // no approval gate; Manual gates mutating tools through the approve() bridge; Plan is read-only research.
1023
+ const onCycleMode = useCallback(() => {
1024
+ setOpMode((cur) => {
1025
+ const next = cur === "auto" ? "manual" : cur === "manual" ? "plan" : "auto";
1026
+ if (next === "plan") {
1027
+ session.setPlanMode(true);
1028
+ }
1029
+ else {
1030
+ session.setPlanMode(false);
1031
+ session.setPermissionMode(next === "auto" ? "bypass" : "gated");
1032
+ }
1033
+ setPlanMode(next === "plan");
1034
+ sys(next === "auto" ? "◆ mode → AUTO — I execute without asking (shift+tab to cycle)"
1035
+ : next === "manual" ? "◈ mode → MANUAL — I ask before mutating (writes/edits/shell) (shift+tab to cycle)"
1036
+ : "◔ mode → PLAN — read-only research + a proposed plan; nothing runs (shift+tab to cycle)");
1037
+ return next;
1038
+ });
1039
+ }, [sys]);
1009
1040
  const onInterrupt = useCallback(() => {
1010
1041
  if (statusRef.current === "idle") {
1011
1042
  bg.dispose();
@@ -1045,7 +1076,7 @@ function Root() {
1045
1076
  ? `${spin} reading your prompt… (${fmtDuration(elapsed)})`
1046
1077
  : `${spin} ${fmtMeta(elapsed, liveTok)}`
1047
1078
  : metrics;
1048
- return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, liveTools: liveTools, route: route, ctxPct: ctxPct, version: VERSION, metrics: liveMetrics, sessionTokens: session.sessionTokens() + liveTok, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, thinkMode: thinkMode, verbs: settings.verbs, bgAgents: bgAgents, onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, approval: approval, question: question, modelPicker: modelPicker, onApprovalDecide: (allow, always) => {
1079
+ return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, liveTools: liveTools, route: route, ctxPct: ctxPct, version: VERSION, metrics: liveMetrics, sessionTokens: session.sessionTokens() + liveTok, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, thinkMode: thinkMode, verbs: settings.verbs, bgAgents: bgAgents, onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, onCycleMode: onCycleMode, opMode: opMode, approval: approval, question: question, modelPicker: modelPicker, onApprovalDecide: (allow, always) => {
1049
1080
  const cur = approval;
1050
1081
  if (cur)
1051
1082
  settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
package/dist/mcp/index.js CHANGED
@@ -3,6 +3,15 @@ import { McpHttpClient } from "./client.js";
3
3
  import { McpStdioClient } from "./stdio.js";
4
4
  import { capToolResult } from "../tools/executor.js";
5
5
  const SEP = ":"; // namespace separator: "compose:compose_list"
6
+ // MCP servers that ship STANDARD with Operator — always available, independent of the full-fleet `mcp`
7
+ // setting. report-mcp (ReportLab PDF generation) is core: a coding agent should be able to produce a
8
+ // PDF out of the box without the owner opting the entire fleet in. Extend this list as more become core.
9
+ export const STANDARD_MCP_SERVERS = ["report-mcp"];
10
+ /** The subset of the on-disk config that ships standard (report-mcp, …). Empty when none are configured. */
11
+ export async function loadStandardServers() {
12
+ const all = await loadMcpConfig();
13
+ return all.filter((s) => STANDARD_MCP_SERVERS.includes(s.name));
14
+ }
6
15
  /** Manages the fleet's MCP servers: lazy tool discovery, namespaced dispatch, health-gated. */
7
16
  export class McpHub {
8
17
  servers;
package/dist/session.js CHANGED
@@ -85,7 +85,8 @@ export class Session {
85
85
  localSchemas;
86
86
  hub;
87
87
  tools;
88
- policy;
88
+ policy; // rebuilt by setPermissionMode (Shift+Tab mode cycle)
89
+ permissionCfg = { mode: "bypass" }; // base config; mode is swapped at runtime
89
90
  approve;
90
91
  telemetry;
91
92
  eventSink;
@@ -135,7 +136,8 @@ export class Session {
135
136
  this.wantRecall = cfg.recall ?? true;
136
137
  this.wantMcp = cfg.mcp === true || !!cfg.mcpHub;
137
138
  this.hub = cfg.mcpHub;
138
- this.policy = new PermissionPolicy(cfg.permissions);
139
+ this.permissionCfg = cfg.permissions ?? { mode: "bypass" };
140
+ this.policy = new PermissionPolicy(this.permissionCfg);
139
141
  this.approve = cfg.approve;
140
142
  this.telemetry = new Telemetry(cfg.telemetry);
141
143
  this.eventSink = cfg.eventSink;
@@ -192,6 +194,19 @@ export class Session {
192
194
  inPlanMode() {
193
195
  return this.planMode;
194
196
  }
197
+ /** Runtime permission-mode switch (Shift+Tab mode cycle). Rebuilds the policy + tool executor,
198
+ * preserving the base tier + rules; only the mode changes. Plan mode is separate (setPlanMode) and
199
+ * takes precedence in buildTools while active. */
200
+ setPermissionMode(mode) {
201
+ if (this.permissionCfg.mode === mode)
202
+ return;
203
+ this.permissionCfg = { ...this.permissionCfg, mode };
204
+ this.policy = new PermissionPolicy(this.permissionCfg);
205
+ this.tools = this.buildTools();
206
+ }
207
+ currentPermissionMode() {
208
+ return this.policy.currentMode();
209
+ }
195
210
  /** Set extended-reasoning mode (/think, /ultrathink). "think" re-enables Aurora's native reasoning for
196
211
  * each turn; "ultrathink" also pushes for deeper step-by-step reasoning via the system prompt. */
197
212
  setThinkMode(mode) {
@@ -57,11 +57,11 @@ async function resolveBinary() {
57
57
  /** Build a chauffeur-only MCP hub (curated tools, `mcp --direct` so it self-contains without a daemon),
58
58
  * or null when chauffeur isn't installed. Injected into the foreground Session when computer control is
59
59
  * enabled, so embodiment gets the robust driver without turning on the whole fleet MCP surface. */
60
- export async function buildChauffeurHub() {
60
+ export async function buildChauffeurServer() {
61
61
  const command = await resolveBinary();
62
62
  if (!command)
63
63
  return null;
64
- const server = {
64
+ return {
65
65
  name: "chauffeur",
66
66
  transport: "stdio",
67
67
  command,
@@ -69,5 +69,8 @@ export async function buildChauffeurHub() {
69
69
  advertise: true,
70
70
  tools: [...CHAUFFEUR_TOOLS], // curated allowlist (the McpHub filters discovery to these)
71
71
  };
72
- return new McpHub([server]);
72
+ }
73
+ export async function buildChauffeurHub() {
74
+ const server = await buildChauffeurServer();
75
+ return server ? new McpHub([server]) : null;
73
76
  }
package/dist/ui/App.js CHANGED
@@ -16,7 +16,7 @@ import { QuestionPrompt } from "./QuestionPrompt.js";
16
16
  // calls at once; anything past the cap is summarized as a count instead of another row.
17
17
  const MAX_LIVE_TOOL_ROWS = 6;
18
18
  export function App(props) {
19
- const { messages, live = null, status, thinkingVerb, verbs, stepLabel, liveTools = [], route, ctxPct, version, build, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, onSubmit, onQueue, onInterrupt, approval = null, onApprovalDecide, question = null, modelPicker = null } = props;
19
+ const { messages, live = null, status, thinkingVerb, verbs, stepLabel, liveTools = [], route, ctxPct, version, build, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, onSubmit, onQueue, onInterrupt, onCycleMode, opMode, approval = null, onApprovalDecide, question = null, modelPicker = null } = props;
20
20
  const thinking = status === "thinking" || status === "streaming";
21
21
  // A parallel batch (2+ live rows) gets its own per-call view instead of the single-line StepSpinner —
22
22
  // a lone call isn't worth a bordered block, the braille spinner + name already says enough.
@@ -24,5 +24,5 @@ export function App(props) {
24
24
  const showSpinner = status === "recovering" || (status === "executing" && !showParallelRows) || thinking;
25
25
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Transcript, { entries: messages, live: live }), showSpinner && (_jsx(Box, { marginTop: 1, marginBottom: 1, children: status === "recovering" ? _jsx(RecoverSpinner, { active: true, label: stepLabel })
26
26
  : status === "executing" ? _jsx(StepSpinner, { active: true, label: stepLabel })
27
- : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), showParallelRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "gray", paddingX: 1, children: [_jsxs(Text, { dimColor: true, children: ["running ", liveTools.length, " tools in parallel"] }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => _jsx(ToolStep, { step: step }, step.id)), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { dimColor: true, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), _jsx(BgPanel, { agents: bgAgents }), _jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(QuestionPrompt, { pending: modelPicker }), _jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, disabled: status !== "idle", suspended: !!approval || !!question || !!modelPicker }), _jsx(InputRule, {})] }));
27
+ : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), showParallelRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, borderStyle: "round", borderColor: "gray", paddingX: 1, children: [_jsxs(Text, { dimColor: true, children: ["running ", liveTools.length, " tools in parallel"] }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => _jsx(ToolStep, { step: step }, step.id)), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { dimColor: true, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), _jsx(BgPanel, { agents: bgAgents }), _jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(QuestionPrompt, { pending: modelPicker }), _jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, onCycleMode: onCycleMode, opMode: opMode, disabled: status !== "idle", suspended: !!approval || !!question || !!modelPicker }), _jsx(InputRule, {})] }));
28
28
  }
@@ -16,7 +16,7 @@ import { Box, Text, useInput, useStdin } from "ink";
16
16
  import { InputHistory } from "./useInputHistory.js";
17
17
  const PASTE_START = "\x1b[200~";
18
18
  const PASTE_END = "\x1b[201~";
19
- export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended, prompt = "› " }) {
19
+ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended, onCycleMode, opMode, prompt = "› " }) {
20
20
  const [value, setValue] = useState("");
21
21
  const pasteCountRef = useRef(0);
22
22
  const pasteBufRef = useRef(null); // non-null while inside a bracketed paste
@@ -66,6 +66,12 @@ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended,
66
66
  return; // an approval prompt owns the keyboard — don't consume or echo keystrokes
67
67
  if (pasteBufRef.current !== null)
68
68
  return; // raw paste bytes are owned by the data handler above
69
+ // Shift+Tab cycles the operating mode (Claude-Code parity). Terminals send backtab as ESC[Z, which
70
+ // Ink surfaces as key.tab + key.shift. Handled before text so it never lands a character in the draft.
71
+ if (key.tab && key.shift) {
72
+ onCycleMode?.();
73
+ return;
74
+ }
69
75
  if ((key.ctrl && ch === "c") || key.escape) {
70
76
  onInterrupt();
71
77
  return;
@@ -120,7 +126,7 @@ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended,
120
126
  // Surface any image/video paths in the draft as attachment chips so the user can see multiple
121
127
  // media are attached (dragged/pasted paths land in the text). De-duped, basename only.
122
128
  const attachments = Array.from(new Set(value.match(MEDIA_RE) ?? []));
123
- return (_jsxs(Box, { flexDirection: "column", children: [lines.map((line, i) => (_jsxs(Text, { children: [i === 0 ? prompt : " ", line, i === lines.length - 1 ? "▌" : ""] }, i))), attachments.length > 0 && (_jsx(Text, { dimColor: true, children: " " + attachments.map((a) => `${VIDEO_RE.test(a) ? "▷ vid" : "◇ img"}:${a.split("/").pop()}`).join(" ") }))] }));
129
+ return (_jsxs(Box, { flexDirection: "column", children: [lines.map((line, i) => (_jsxs(Text, { children: [i === 0 ? prompt : " ", line, i === lines.length - 1 ? "▌" : ""] }, i))), attachments.length > 0 && (_jsx(Text, { dimColor: true, children: " " + attachments.map((a) => `${VIDEO_RE.test(a) ? "▷ vid" : "◇ img"}:${a.split("/").pop()}`).join(" ") })), opMode && (_jsx(Text, { dimColor: true, children: ` ${opMode === "auto" ? "◆ auto" : opMode === "manual" ? "◈ manual" : "◔ plan"} · shift+tab to cycle` }))] }));
124
130
  }
125
131
  // Recognize media file paths in the draft. IMAGE covers the common still formats, VIDEO the moving
126
132
  // ones; a path matching VIDEO is chipped as video, otherwise image. Extensions only — no I/O.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
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": {