@0perator/operator 0.1.29 → 0.1.30

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
@@ -18,7 +18,7 @@ import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
18
18
  import { join } from "node:path";
19
19
  import { homedir, hostname } from "node:os";
20
20
  import { createHash } from "node:crypto";
21
- const VERSION = "0.1.29";
21
+ const VERSION = "0.1.30";
22
22
  // operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
23
23
  const settings = loadSettings();
24
24
  // Propagate the resolved sandbox mode to the tool layer (registry reads KODE_SANDBOX at exec time).
@@ -143,6 +143,7 @@ const HELP = [
143
143
  " /model current endpoint (aurora · 1M), context %, turn count",
144
144
  " /endpoints show the aurora endpoint + live health",
145
145
  " /services ensure/inspect the service lever (aurora+autopilot+searxng); /services stop",
146
+ " /audit [n] recent tool + control-plane events from the audit trail (default 15)",
146
147
  " /compact force-compact the conversation now",
147
148
  " /remember <note> store a note to recall in future sessions",
148
149
  " /memory [query] show remembered notes (all, or matching query)",
@@ -544,6 +545,36 @@ function Root() {
544
545
  sys("endpoints:\n" + s.endpoints().map((e) => ` ${h[e.name] ? "●" : "○"} ${e.name} ${e.base} ${e.model} ctx ${e.ctxWindow.toLocaleString()}`).join("\n"));
545
546
  break;
546
547
  }
548
+ case "audit": {
549
+ // The human-supervisor view of the frozen event stream: recent tool decisions + control events
550
+ // (tier denials, signature lines, RC) straight from the audit JSONL. Read-only.
551
+ const n = Math.max(1, Math.min(50, Number(arg) || 15));
552
+ const file = (process.env.KODE_EVENTS_FILE || process.env.KODE_AUDIT_FILE || join(homedir(), ".axe", "operator", "events.jsonl"));
553
+ let lines = [];
554
+ try {
555
+ lines = readFileSync(file, "utf8").trim().split("\n").filter(Boolean);
556
+ }
557
+ catch { /* no audit yet */ }
558
+ if (!lines.length) {
559
+ sys(`no audit events yet (${settings.permissions.tier ?? "admin"} tier, ${settings.permissions.mode} mode). Events record once enforcement is on.`);
560
+ break;
561
+ }
562
+ const rows = lines.slice(-n).map((l) => { try {
563
+ return JSON.parse(l);
564
+ }
565
+ catch {
566
+ return null;
567
+ } }).filter(Boolean)
568
+ .filter((e) => e.kind === "tool" || e.kind === "control")
569
+ .map((e) => {
570
+ const t = new Date(e.ts).toLocaleTimeString();
571
+ if (e.kind === "tool")
572
+ return ` ${t} ${e.tool.decision === "deny" ? "✗" : e.tool.approved === false ? "⃠" : "●"} ${e.tool.name} [${e.tool.outcome}]${e.tool.args ? " " + String(e.tool.args).slice(0, 60) : ""}`;
573
+ return ` ${t} ⚑ ${e.control.event}${e.control.detail ? " " + e.control.detail : ""}`;
574
+ });
575
+ sys(rows.length ? `audit (last ${rows.length}):\n` + rows.join("\n") : "no tool/control events in the audit log yet");
576
+ break;
577
+ }
547
578
  case "services": {
548
579
  // The lever, on demand: `/services` probes + starts any down launchd service; `/services stop`
549
580
  // tears down only the session-scoped SearXNG (Aurora/autopilot are shared and stay up).
@@ -656,7 +687,7 @@ function Root() {
656
687
  const liveMetrics = active
657
688
  ? `${SPIN[Math.floor(elapsed * 4) % SPIN.length]} ${fmtMeta(elapsed, liveTok)}`
658
689
  : metrics;
659
- return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, route: route, ctxPct: ctxPct, version: VERSION, metrics: liveMetrics, authUser: authUser, verbs: settings.verbs, bgAgents: bgAgents, onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, approval: approval, onApprovalDecide: (allow, always) => {
690
+ 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, verbs: settings.verbs, bgAgents: bgAgents, onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, approval: approval, onApprovalDecide: (allow, always) => {
660
691
  const cur = approval;
661
692
  if (cur)
662
693
  settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
package/dist/ui/App.js CHANGED
@@ -9,10 +9,10 @@ import { StepSpinner, RecoverSpinner } from "./ActivitySpinner.js";
9
9
  import { BgPanel } from "./BgPanel.js";
10
10
  import { ApprovalPrompt } from "./ApprovalPrompt.js";
11
11
  export function App(props) {
12
- const { messages, live = null, status, thinkingVerb, verbs, stepLabel, route, ctxPct, version, build, metrics, authUser, bgAgents, onSubmit, onQueue, onInterrupt, approval = null, onApprovalDecide } = props;
12
+ const { messages, live = null, status, thinkingVerb, verbs, stepLabel, route, ctxPct, version, build, metrics, authUser, tier, bgAgents, onSubmit, onQueue, onInterrupt, approval = null, onApprovalDecide } = props;
13
13
  const thinking = status === "thinking" || status === "streaming";
14
14
  const showSpinner = status === "recovering" || status === "executing" || thinking;
15
15
  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 })
16
16
  : status === "executing" ? _jsx(StepSpinner, { active: true, label: stepLabel })
17
- : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), _jsx(BgPanel, { agents: bgAgents }), _jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser }), _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, disabled: status !== "idle", suspended: !!approval }), _jsx(InputRule, {})] }));
17
+ : _jsx(ThinkingSpinner, { active: true, verb: thinkingVerb, verbs: verbs, metrics: metrics }) })), _jsx(BgPanel, { agents: bgAgents }), _jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(StatusRule, { route: route, ctxPct: ctxPct, version: version, build: build, user: authUser, tier: tier }), _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, onInterrupt: onInterrupt, disabled: status !== "idle", suspended: !!approval }), _jsx(InputRule, {})] }));
18
18
  }
@@ -1,9 +1,10 @@
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 }) {
3
+ export function StatusRule({ route, ctxPct, version, build, user, tier }) {
4
4
  const who = user ? `⬤ ${user} · ` : "";
5
- // Info block: identity · route · ctx% · version. Kept as one string so the width math is exact.
6
- const info = `${who}${route} · ${Math.round(ctxPct)}% · v${version}${build ? ` ·${build}` : ""}`;
5
+ const seat = tier && tier !== "admin" ? `⛨ ${tier} · ` : ""; // a narrowed seat is visible; the owner's admin is not
6
+ // Info block: seat · identity · route · ctx% · version. Kept as one string so the width math is exact.
7
+ const info = `${seat}${who}${route} · ${Math.round(ctxPct)}% · v${version}${build ? ` ·${build}` : ""}`;
7
8
  // The full right-hand content, styled below in segments (✷ magenta, OPERATOR bold, info dim). This
8
9
  // plain string is only used to measure width so the leading rule fills precisely.
9
10
  const right = `✷ OPERATOR · ${info} ─`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
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": {