@0perator/operator 0.1.36 → 0.1.38

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/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import { expandFileMentions } from "./util/mentions.js";
19
19
  import { join } from "node:path";
20
20
  import { homedir, hostname } from "node:os";
21
21
  import { createHash } from "node:crypto";
22
- const VERSION = "0.1.36";
22
+ const VERSION = "0.1.38";
23
23
  // operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
24
24
  const settings = loadSettings();
25
25
  // Propagate the resolved sandbox mode to the tool layer (registry reads KODE_SANDBOX at exec time).
@@ -151,6 +151,8 @@ const HELP = [
151
151
  " /audit [n] recent tool + control-plane events from the audit trail (default 15)",
152
152
  " /dashboard launch the live swarm console (watches every Operator session)",
153
153
  " /plan plan mode: read-only research + propose a plan (/plan again to execute)",
154
+ " /think extended reasoning: Aurora thinks before answering (/think again = off)",
155
+ " /ultrathink deep, exhaustive reasoning for hard problems (/ultrathink again = off)",
154
156
  " /compact force-compact the conversation now",
155
157
  " /remember <note> store a note to recall in future sessions",
156
158
  " /memory [query] show remembered notes (all, or matching query)",
@@ -188,6 +190,7 @@ function Root() {
188
190
  const [bgAgents, setBgAgents] = useState([]);
189
191
  const [authUser, setAuthUser] = useState(""); // signed-in identity for the status rule
190
192
  const [planMode, setPlanMode] = useState(false); // /plan: read-only research + propose, shown as a status badge
193
+ const [thinkMode, setThinkMode] = useState("off"); // /think, /ultrathink badge
191
194
  const [elapsed, setElapsed] = useState(0); // live seconds since the current turn started (ticked by a
192
195
  const turnStartRef = useRef(0); // timer, so the clock advances even during a long reasoning
193
196
  // phase where no content tokens stream — that was the "timer stuck" bug (Ink only re-renders on deltas).
@@ -573,6 +576,22 @@ function Root() {
573
576
  : "plan mode OFF — back to normal execution.");
574
577
  break;
575
578
  }
579
+ case "think": {
580
+ const on = s.currentThinkMode() !== "think";
581
+ s.setThinkMode(on ? "think" : "off");
582
+ setThinkMode(on ? "think" : "off");
583
+ sys(on ? "✲ think ON — Aurora reasons (shown dimmed) before answering. /think again to turn off."
584
+ : "think off — back to fast direct answers.");
585
+ break;
586
+ }
587
+ case "ultrathink": {
588
+ const on = s.currentThinkMode() !== "ultrathink";
589
+ s.setThinkMode(on ? "ultrathink" : "off");
590
+ setThinkMode(on ? "ultrathink" : "off");
591
+ sys(on ? "✲✲ ultrathink ON — Aurora reasons deeply + exhaustively before answering (slower, deeper). /ultrathink again to turn off."
592
+ : "ultrathink off — back to fast direct answers.");
593
+ break;
594
+ }
576
595
  case "audit": {
577
596
  // The human-supervisor view of the frozen event stream: recent tool decisions + control events
578
597
  // (tier denials, signature lines, RC) straight from the audit JSONL. Read-only.
@@ -686,7 +705,7 @@ function Root() {
686
705
  onInterrupt: () => s.interrupt(), // follower cancels the turn
687
706
  onState: (st, detail) => {
688
707
  if (st === "live")
689
- sys(`✷ remote control LIVE — session ${rh.id} · attach from the app to drive it. /remotecontrol again to stop.`);
708
+ sys(`✷ remote control LIVE — session ${rh.id}\n Continue on your phone or at https://0perator.co/session/${rh.id}\n /remotecontrol again to stop.`);
690
709
  else if (st === "error")
691
710
  sys(`remote control error: ${detail ?? "connection lost"} — /remotecontrol to retry`);
692
711
  else if (st === "closed")
@@ -748,7 +767,7 @@ function Root() {
748
767
  const liveMetrics = active
749
768
  ? `${SPIN[Math.floor(elapsed * 4) % SPIN.length]} ${fmtMeta(elapsed, liveTok)}`
750
769
  : metrics;
751
- return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, route: route, ctxPct: ctxPct, version: VERSION, metrics: liveMetrics, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, verbs: settings.verbs, bgAgents: bgAgents, onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, approval: approval, question: question, onApprovalDecide: (allow, always) => {
770
+ return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, route: route, ctxPct: ctxPct, version: VERSION, metrics: liveMetrics, 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, onApprovalDecide: (allow, always) => {
752
771
  const cur = approval;
753
772
  if (cur)
754
773
  settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
@@ -145,6 +145,7 @@ export async function runTurn(userInput, conversation, opts) {
145
145
  maxTokens,
146
146
  temperature: opts.temperature,
147
147
  tools: opts.toolSchemas,
148
+ thinking: opts.thinking,
148
149
  signal: opts.signal,
149
150
  onDelta: opts.onDelta,
150
151
  onReasoning: opts.onReasoning,
@@ -60,6 +60,10 @@ function requestBody(messages, o, stream) {
60
60
  model: o.model, messages, stream,
61
61
  max_tokens: o.maxTokens ?? 8192, temperature: o.temperature ?? 0.7,
62
62
  ...(o.tools?.length ? { tools: o.tools, tool_choice: "auto" } : {}),
63
+ // /think: re-enable the model's native reasoning for THIS request, overriding the server's
64
+ // enable_thinking:false default (set for speed). Verified this per-request override works on the
65
+ // Aurora build; reasoning arrives as reasoning_content and renders dimmed.
66
+ ...(o.thinking ? { chat_template_kwargs: { enable_thinking: true } } : {}),
63
67
  // NO repeat/presence/frequency penalty knobs — SPEC §1: they break tool-calling.
64
68
  });
65
69
  }
package/dist/session.js CHANGED
@@ -95,6 +95,7 @@ export class Session {
95
95
  wantRecall;
96
96
  recallBlock = ""; // memory recalled on the first turn, folded into the system prompt thereafter
97
97
  planMode = false; // /plan: research read-only + propose a plan, no mutations until the owner approves
98
+ thinkMode = "off"; // /think, /ultrathink — extended reasoning
98
99
  recalled = false;
99
100
  constructor(cfg = {}) {
100
101
  // Per-session tool registry: the base set, plus `spawn_agent` when the shell provides a delegate
@@ -144,6 +145,17 @@ export class Session {
144
145
  `(/plan) to let you execute.`;
145
146
  return (base ?? "") + plan;
146
147
  }
148
+ /** The system prompt with the ultrathink push appended when that mode is on. /think alone just enables
149
+ * the model's native reasoning (no prompt change needed); ultrathink also asks it to go deeper. */
150
+ sysWithThink() {
151
+ const base = this.sys();
152
+ if (this.thinkMode !== "ultrathink")
153
+ return base;
154
+ const push = `\n\n## ULTRATHINK (active)\nThink exhaustively before answering: reason step by step ` +
155
+ `through the whole problem, surface assumptions, weigh alternatives and edge cases, and check your ` +
156
+ `own work — then give the answer. Depth over speed for this turn.`;
157
+ return (base ?? "") + push;
158
+ }
147
159
  /** Compose the tool executor: local tools + MCP (composite) with the permission/audit layer on top.
148
160
  * withPermissions returns the composite UNCHANGED when the policy is inert (bypass) — zero overhead.
149
161
  * In plan mode a read-only gated policy (no approver → mutating tools fail-safe deny) overrides the
@@ -165,6 +177,14 @@ export class Session {
165
177
  inPlanMode() {
166
178
  return this.planMode;
167
179
  }
180
+ /** Set extended-reasoning mode (/think, /ultrathink). "think" re-enables Aurora's native reasoning for
181
+ * each turn; "ultrathink" also pushes for deeper step-by-step reasoning via the system prompt. */
182
+ setThinkMode(mode) {
183
+ this.thinkMode = mode;
184
+ }
185
+ currentThinkMode() {
186
+ return this.thinkMode;
187
+ }
168
188
  /** Is the currently-selected endpoint reachable? Lets the shell fail clearly before a turn. */
169
189
  health() {
170
190
  return health(this.inner.base);
@@ -306,10 +326,11 @@ export class Session {
306
326
  router: this.router,
307
327
  tools: this.tools,
308
328
  toolSchemas: this.allSchemas(),
309
- systemPrompt: this.sys(),
329
+ systemPrompt: this.sysWithThink(),
310
330
  summarize: this.summarize,
311
331
  maxTokens: this.maxTokens,
312
332
  temperature: this.temperature,
333
+ thinking: this.thinkMode !== "off", // /think, /ultrathink re-enable Aurora's native reasoning
313
334
  signal: controller.signal,
314
335
  onDelta: h.onDelta,
315
336
  onReasoning: h.onReasoning,
package/dist/ui/App.js CHANGED
@@ -10,10 +10,10 @@ import { BgPanel } from "./BgPanel.js";
10
10
  import { ApprovalPrompt } from "./ApprovalPrompt.js";
11
11
  import { QuestionPrompt } from "./QuestionPrompt.js";
12
12
  export function App(props) {
13
- const { messages, live = null, status, thinkingVerb, verbs, stepLabel, route, ctxPct, version, build, metrics, authUser, tier, planMode, bgAgents, onSubmit, onQueue, onInterrupt, approval = null, onApprovalDecide, question = null } = props;
13
+ const { messages, live = null, status, thinkingVerb, verbs, stepLabel, route, ctxPct, version, build, metrics, authUser, tier, planMode, thinkMode, bgAgents, onSubmit, onQueue, onInterrupt, approval = null, onApprovalDecide, question = null } = props;
14
14
  const thinking = status === "thinking" || status === "streaming";
15
15
  const showSpinner = status === "recovering" || status === "executing" || thinking;
16
16
  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 })
17
17
  : status === "executing" ? _jsx(StepSpinner, { active: true, label: stepLabel })
18
- : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), _jsx(BgPanel, { agents: bgAgents }), _jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier, planMode: planMode }), _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, disabled: status !== "idle", suspended: !!approval || !!question }), _jsx(InputRule, {})] }));
18
+ : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), _jsx(BgPanel, { agents: bgAgents }), _jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode }), _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, disabled: status !== "idle", suspended: !!approval || !!question }), _jsx(InputRule, {})] }));
19
19
  }
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
- export function StatusRule({ route, ctxPct, version, build, user, tier, planMode }) {
3
+ export function StatusRule({ route, ctxPct, version, build, user, tier, planMode, thinkMode }) {
4
4
  const who = user ? `⬤ ${user} · ` : "";
5
5
  const seat = tier && tier !== "admin" ? `⛨ ${tier} · ` : ""; // a narrowed seat is visible; the owner's admin is not
6
6
  const plan = planMode ? `◔ plan · ` : ""; // read-only research mode is visible while active
7
- // Info block: plan · seat · identity · route · ctx% · version. One string so the width math is exact.
8
- const info = `${plan}${seat}${who}${route} · ${Math.round(ctxPct)}% · v${version}${build ? ` ·${build}` : ""}`;
7
+ const think = thinkMode === "ultrathink" ? `✲✲ ultrathink · ` : thinkMode === "think" ? `✲ think · ` : "";
8
+ // Info block: think · plan · seat · identity · route · ctx% · version. One string so the width math is exact.
9
+ const info = `${think}${plan}${seat}${who}${route} · ${Math.round(ctxPct)}% · v${version}${build ? ` ·${build}` : ""}`;
9
10
  // The full right-hand content, styled below in segments (✷ magenta, OPERATOR bold, info dim). This
10
11
  // plain string is only used to measure width so the leading rule fills precisely.
11
12
  const right = `✷ OPERATOR · ${info} ─`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
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": {