@0perator/operator 0.1.55 → 0.1.56

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,14 @@ 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.56 — 2026-09-22
8
+ - **Shift+Tab cycles the operating mode (Claude-Code parity).** AUTO (execute without asking) → MANUAL
9
+ (approve mutating tools via the gated policy + approve bridge) → PLAN (read-only research + a proposed
10
+ plan, nothing runs) → AUTO. A persistent dim hint under the input shows the current mode, and each
11
+ switch prints a one-line confirmation. Maps to the mobile Manual/Auto/Plan selector. New Session API:
12
+ setPermissionMode() rebuilds the policy at runtime (preserving tier + rules); plan mode was already native.
13
+ - Tests: 365/365.
14
+
7
15
  ## 0.1.55 — 2026-09-22
8
16
  - **Remote-engine auth — Operator now runs against a REMOTE engine.** The model call sent no
9
17
  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.56";
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).
@@ -320,6 +320,9 @@ function Root() {
320
320
  const [bgAgents, setBgAgents] = useState([]);
321
321
  const [authUser, setAuthUser] = useState(""); // signed-in identity for the status rule
322
322
  const [planMode, setPlanMode] = useState(false); // /plan: read-only research + propose, shown as a status badge
323
+ // Operating mode, cycled with Shift+Tab (like Claude Code): auto (no gate) → manual (approve mutations)
324
+ // → plan (read-only + propose) → auto. Auto=bypass policy, Manual=gated policy, Plan=session plan mode.
325
+ const [opMode, setOpMode] = useState(settings.permissions.mode === "gated" ? "manual" : "auto");
323
326
  const [thinkMode, setThinkMode] = useState("off"); // /think, /ultrathink badge
324
327
  const [elapsed, setElapsed] = useState(0); // live seconds since the current turn started (ticked by a
325
328
  const turnStartRef = useRef(0); // timer, so the clock advances even during a long reasoning
@@ -1006,6 +1009,25 @@ function Root() {
1006
1009
  }, [sendTurn, handleSlash]);
1007
1010
  submitRef.current = onSubmit;
1008
1011
  const onQueue = useCallback((text) => { queued.current = queued.current ? `${queued.current}\n${text}` : text; }, []);
1012
+ // Shift+Tab cycles the operating mode (Claude-Code parity). auto→manual→plan→auto. Auto drives with
1013
+ // no approval gate; Manual gates mutating tools through the approve() bridge; Plan is read-only research.
1014
+ const onCycleMode = useCallback(() => {
1015
+ setOpMode((cur) => {
1016
+ const next = cur === "auto" ? "manual" : cur === "manual" ? "plan" : "auto";
1017
+ if (next === "plan") {
1018
+ session.setPlanMode(true);
1019
+ }
1020
+ else {
1021
+ session.setPlanMode(false);
1022
+ session.setPermissionMode(next === "auto" ? "bypass" : "gated");
1023
+ }
1024
+ setPlanMode(next === "plan");
1025
+ sys(next === "auto" ? "◆ mode → AUTO — I execute without asking (shift+tab to cycle)"
1026
+ : next === "manual" ? "◈ mode → MANUAL — I ask before mutating (writes/edits/shell) (shift+tab to cycle)"
1027
+ : "◔ mode → PLAN — read-only research + a proposed plan; nothing runs (shift+tab to cycle)");
1028
+ return next;
1029
+ });
1030
+ }, [sys]);
1009
1031
  const onInterrupt = useCallback(() => {
1010
1032
  if (statusRef.current === "idle") {
1011
1033
  bg.dispose();
@@ -1045,7 +1067,7 @@ function Root() {
1045
1067
  ? `${spin} reading your prompt… (${fmtDuration(elapsed)})`
1046
1068
  : `${spin} ${fmtMeta(elapsed, liveTok)}`
1047
1069
  : 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) => {
1070
+ 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
1071
  const cur = approval;
1050
1072
  if (cur)
1051
1073
  settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
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) {
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.56",
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": {