@0perator/operator 0.2.0 → 0.2.1

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.
Files changed (75) hide show
  1. package/README.md +4 -3
  2. package/dist/auth/commands.js +7 -3
  3. package/dist/auth/identity.js +1 -0
  4. package/dist/auth/staff.js +55 -0
  5. package/dist/autonomy/delegate-mode.js +2 -2
  6. package/dist/autonomy/delegate.js +41 -14
  7. package/dist/autonomy/headless.js +7 -4
  8. package/dist/autonomy/index.js +2 -4
  9. package/dist/autonomy/session-factory.js +11 -12
  10. package/dist/autonomy/subagent-model.js +17 -7
  11. package/dist/background/capacity.js +136 -0
  12. package/dist/background/evidence.js +42 -0
  13. package/dist/background/index.js +311 -44
  14. package/dist/background/lane-phase.js +60 -0
  15. package/dist/background/lane-summary.js +151 -0
  16. package/dist/background/notices.js +12 -3
  17. package/dist/background/synthesis.js +25 -0
  18. package/dist/bus/inbox.js +150 -6
  19. package/dist/cli.js +191 -96
  20. package/dist/config/features.js +3 -3
  21. package/dist/config/persona.js +29 -3
  22. package/dist/config/settings.js +261 -20
  23. package/dist/config/staff-prompt.js +12 -0
  24. package/dist/engine/agent.js +51 -40
  25. package/dist/engine/aurora.js +36 -4
  26. package/dist/engine/batch-scheduler.js +4 -13
  27. package/dist/engine/compaction.js +1 -1
  28. package/dist/engine/continuation.js +30 -32
  29. package/dist/engine/decision-points.js +2 -3
  30. package/dist/engine/fanout.js +16 -0
  31. package/dist/engine/loop-guard.js +26 -83
  32. package/dist/engine/messages.js +2 -2
  33. package/dist/engine/moa.js +16 -1
  34. package/dist/engine/native-vision-node.js +72 -0
  35. package/dist/engine/native-vision.js +103 -0
  36. package/dist/engine/verify-gate.js +37 -7
  37. package/dist/gateway-cli.js +14 -3
  38. package/dist/memory/live-progress.js +4 -5
  39. package/dist/moa/codeact-lane.js +98 -0
  40. package/dist/moa/codeact-sandbox.js +409 -0
  41. package/dist/moa/codeact.js +140 -0
  42. package/dist/permissions/artifact-visibility.js +10 -0
  43. package/dist/permissions/tier.js +4 -2
  44. package/dist/products/craft.js +2 -2
  45. package/dist/remote/grants.js +119 -0
  46. package/dist/remote/host.js +33 -5
  47. package/dist/router/models.js +24 -14
  48. package/dist/selfimprove/index.js +8 -6
  49. package/dist/services/preflight.js +35 -91
  50. package/dist/session.js +127 -41
  51. package/dist/skills/install-guard.js +68 -0
  52. package/dist/skills/install.js +67 -0
  53. package/dist/toolchain/manifest.json +13 -13
  54. package/dist/tools/background-result.js +1 -1
  55. package/dist/tools/classes.js +103 -0
  56. package/dist/tools/contract.js +1 -1
  57. package/dist/tools/craft.js +13 -2
  58. package/dist/tools/executor.js +25 -15
  59. package/dist/tools/generation-gateway.js +94 -0
  60. package/dist/tools/registry.js +83 -152
  61. package/dist/ui/App.js +15 -4
  62. package/dist/ui/BgPanel.js +15 -10
  63. package/dist/ui/Header.js +1 -6
  64. package/dist/ui/StatusRule.js +18 -7
  65. package/dist/ui/ToolStep.js +3 -3
  66. package/dist/ui/Transcript.js +36 -14
  67. package/dist/ui/batchLine.js +4 -4
  68. package/dist/ui/editdiff.js +2 -4
  69. package/dist/ui/format.js +4 -20
  70. package/dist/ui/liveTools.js +3 -3
  71. package/dist/ui/opsMode.js +20 -0
  72. package/dist/ui/types.js +0 -2
  73. package/dist/update-check.js +17 -6
  74. package/package.json +1 -1
  75. package/dist/tools/mutating.js +0 -15
@@ -27,10 +27,12 @@ import { formatGitStatus } from "./git-status.js";
27
27
  import { DOC_TEXT_EXTS, describeDocText, docExt, extractDocText } from "./doc-text.js";
28
28
  import { askVision, visionGateways, VISION_LIMITS } from "./vision-gateway.js";
29
29
  import { DESIGN_PROBE_JS, DESIGN_QUESTION, MEDIA_CAPS, downloadVideoPage, evenTimes, fmtTime, formatDesignRead, grabFrames, isVideoPageUrl, parseTimestamps } from "./vision-media.js";
30
+ import { generate, generationGateways } from "./generation-gateway.js";
30
31
  import { expandPath, assertContentSearchScope, assertShellHomeWideSearch, assertShellBlindDownload } from "./paths.js";
31
32
  import { resolveReadPath } from "./read-path.js";
32
33
  import { recordRead, getRead, forgetReads, seenView } from "./read-ledger.js"; // per-session read-state (pure, node-free — stays out of the neutral graph)
33
34
  import { CRAFT_TOOLS } from "./craft.js";
35
+ import { artifactVisibility } from "../permissions/artifact-visibility.js";
34
36
  import { runMemoryTool } from "./memory.js";
35
37
  import { documentGenerate } from "./document.js";
36
38
  import { runCronTool } from "../autonomy/cron.js";
@@ -1530,9 +1532,6 @@ async function taskClear(args) {
1530
1532
  // short-lived process that loads FLUX, renders, and exits (steady-state RAM = 0). This is the ONLY sanctioned
1531
1533
  // way to make images — loading a diffusion model inline in a turn pins GBs on the serving box, swaps, and
1532
1534
  // crawls decode to ~1 tok/s. Returns the saved PNG path(s), never the base64 (that would flood the transcript).
1533
- /** Candidate image-service endpoints in priority order: explicit env first, then the shared fleet service
1534
- * (Cloudflare-tunneled — reachable from anywhere), then a local broker as a last resort. De-duped, trailing
1535
- * slash trimmed. KODE_IMAGE_URL / AXE_IMAGE_URL override. */
1536
1535
  /** ONE-API gateway: when KODE_GATEWAY_URL is set, prefer the unified route `api.axe.onl/<service>/…`, which
1537
1536
  * fans out to the broker server-side (one door, one token). Empty when unset → per-broker URLs are used. The
1538
1537
  * gateway strips the `/<service>/` prefix, so the broker still sees its native OpenAI path. See
@@ -1541,11 +1540,6 @@ function gatewayEndpoints(service) {
1541
1540
  const g = process.env.KODE_GATEWAY_URL;
1542
1541
  return g ? [`${g.replace(/\/$/, "")}/${service}`] : [];
1543
1542
  }
1544
- function imageEndpoints() {
1545
- const envs = [process.env.KODE_IMAGE_URL, process.env.AXE_IMAGE_URL].filter(Boolean);
1546
- const defaults = ["https://image.axe.onl", "http://127.0.0.1:8791"];
1547
- return [...new Set([...gatewayEndpoints("images"), ...envs, ...defaults])].map((u) => u.replace(/\/$/, ""));
1548
- }
1549
1543
  /** Candidate IDENTITY-broker endpoints (reference-likeness: SDXL RealVisXL + IP-Adapter-FaceID). Used when
1550
1544
  * image_generate carries a `reference` (preserve a SPECIFIC face). KODE_IDENTITY_URL is tried FIRST: point it at
1551
1545
  * a worker on your own network so a cold render (~80-90s to load the 9.4GB pipeline) never hits the public host's
@@ -1610,8 +1604,7 @@ async function recordMediaGen(rec) {
1610
1604
  * broker). Shared by image_generate + video_generate so the URL-first contract is identical for both. */
1611
1605
  async function saveGeneratedMedia(items, outArg, ext) {
1612
1606
  const { writeFile, mkdir } = await nodeImport("node:fs/promises");
1613
- const { tmpdir } = await nodeImport("node:os");
1614
- const { join, dirname } = await nodeImport("node:path");
1607
+ const { dirname } = await nodeImport("node:path");
1615
1608
  const kind = ext === "png" ? "image" : "video";
1616
1609
  const dotExt = new RegExp(`(\\.${ext})?$`, "i");
1617
1610
  const refs = []; // renderable reference per item — public URL when present, else a local path
@@ -1622,7 +1615,7 @@ async function saveGeneratedMedia(items, outArg, ext) {
1622
1615
  if (b64 && (outArg || !url)) {
1623
1616
  const p = outArg
1624
1617
  ? (items.length > 1 ? outArg.replace(dotExt, `-${i + 1}.${ext}`) : (outArg.toLowerCase().endsWith(`.${ext}`) ? outArg : `${outArg}.${ext}`))
1625
- : join(tmpdir(), `axe-${kind}-${Date.now().toString(36)}-${i + 1}.${ext}`);
1618
+ : operatorPath("artifacts", `axe-${kind}-${Date.now().toString(36)}-${i + 1}.${ext}`);
1626
1619
  await mkdir(dirname(p), { recursive: true }).catch(() => { });
1627
1620
  await writeFile(p, Buffer.from(b64, "base64"));
1628
1621
  saved.push(p);
@@ -1634,6 +1627,8 @@ async function saveGeneratedMedia(items, outArg, ext) {
1634
1627
  }
1635
1628
  return { refs, saved };
1636
1629
  }
1630
+ /** A render takes 160–214 s on today's worker, plus up to 300 s in the route's queue; the router job holds it past the edge's cap. */
1631
+ const IMAGE_TIMEOUT_MS = 600_000;
1637
1632
  async function imageGenerate(args) {
1638
1633
  const prompt = str(args.prompt);
1639
1634
  if (!prompt)
@@ -1641,147 +1636,77 @@ async function imageGenerate(args) {
1641
1636
  const size = /^\d+x\d+$/.test(str(args.size)) ? str(args.size) : "512x512";
1642
1637
  const n = Math.max(1, Math.min(Number(args.n) || 1, 4));
1643
1638
  const wantExpand = args.expand === true || str(args.expand) === "true"; // ask the broker to rewrite the prompt via Aurora (never blocks; used:false = ran on the original)
1644
- // Route reference-bearing requests to the IDENTITY broker (preserve a SPECIFIC face via IP-Adapter-FaceID);
1645
- // plain text-to-image stays on flux. Try identity first when a reference is given, fall back to flux if the
1646
- // identity node is asleep — a request never hard-fails just because one broker is down.
1647
- const wantIdentity = !!str(args.reference);
1648
- let base;
1649
- let identity = false;
1650
- if (wantIdentity)
1639
+ const timeoutMs = Number(args.timeout_ms ?? IMAGE_TIMEOUT_MS);
1640
+ const genBody = { prompt, n, size, ...(wantExpand ? { expand: true } : {}), ...(Number(args.steps) > 0 ? { steps: Number(args.steps) } : {}) };
1641
+ // A reference-bearing request tries the IDENTITY broker first (preserve a SPECIFIC face via IP-Adapter-FaceID). It
1642
+ // has no route yet, so it keeps its direct endpoints; asleep, the image-gen route restyles from the reference instead.
1643
+ let identityBase;
1644
+ if (str(args.reference))
1651
1645
  for (const e of identityEndpoints()) {
1652
1646
  if (await imageHealthy(e)) {
1653
- base = e;
1654
- identity = true;
1647
+ identityBase = e;
1655
1648
  break;
1656
1649
  }
1657
1650
  }
1658
- if (!base)
1659
- for (const e of imageEndpoints()) {
1660
- if (await imageHealthy(e)) {
1661
- base = e;
1662
- break;
1663
- }
1651
+ let answer;
1652
+ if (identityBase) {
1653
+ const ctrl = new AbortController();
1654
+ const timer = setTimeout(() => ctrl.abort(), timeoutMs);
1655
+ try {
1656
+ const res = await fetch(`${identityBase}/v1/images/generations`, {
1657
+ method: "POST", signal: ctrl.signal,
1658
+ headers: { "Content-Type": "application/json", "User-Agent": "operator/kode-tsi", ...mediaAuth() },
1659
+ body: JSON.stringify({ ...genBody, reference: str(args.reference), strength: Number(args.strength ?? 0.65), ip_adapter_scale: Number(args.ip_adapter_scale ?? 0.8) }),
1660
+ });
1661
+ if (!res.ok)
1662
+ return `error: identity worker returned ${res.status}`;
1663
+ answer = { json: (await res.json().catch(() => ({}))) };
1664
+ }
1665
+ catch (e) {
1666
+ const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1667
+ return `error: identity worker unreachable at ${identityBase} (${msg})`;
1668
+ }
1669
+ finally {
1670
+ clearTimeout(timer);
1664
1671
  }
1665
- if (!base)
1666
- return `error: no image service reachable. Bring up the flux-worker (image.axe.onl / :8791)${wantIdentity ? " or the identity-worker (identity.axe.onl / :8793)" : ""}. Do NOT load a diffusion model inline — that starves the serving model.`;
1667
- const ctrl = new AbortController();
1668
- const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? 180_000)); // a cold FLUX load + denoise is ~tens of seconds
1669
- try {
1670
- const genBody = { prompt, n, size, ...(wantExpand ? { expand: true } : {}), ...(Number(args.steps) > 0 ? { steps: Number(args.steps) } : {}) };
1671
- if (!identity)
1672
- genBody.model = "flux-schnell"; // the identity broker runs RealVisXL and picks its own base
1673
- if (str(args.reference)) {
1674
- genBody.reference = str(args.reference); // the FACE (identity) — or the init (flux)
1675
- genBody.strength = Number(args.strength ?? 0.65);
1676
- if (identity)
1677
- genBody.ip_adapter_scale = Number(args.ip_adapter_scale ?? 0.8); // IP-Adapter-FaceID strength
1678
- else
1679
- genBody.image = str(args.reference); // flux img2img: the reference doubles as init
1680
- }
1681
- const res = await fetch(`${base}/v1/images/generations`, {
1682
- method: "POST", signal: ctrl.signal,
1683
- headers: { "Content-Type": "application/json", "User-Agent": "operator/kode-tsi", ...mediaAuth() },
1684
- body: JSON.stringify(genBody),
1685
- });
1686
- if (!res.ok)
1687
- return `error: image worker returned ${res.status} — ensure the flux-worker broker (com.axe.flux-worker) is up`;
1688
- const j = (await res.json().catch(() => ({})));
1689
- const imgs = j.data ?? [];
1690
- if (!imgs.length)
1691
- return "error: image worker returned no image data";
1692
- const { refs, saved } = await saveGeneratedMedia(imgs, str(args.out), "png");
1693
- if (!refs.length)
1694
- return "error: image worker returned no url and no decodable PNG";
1695
- const exp = j.axe_prompt_expansion?.used ? j.axe_prompt_expansion.expanded : undefined; // the broker-rewritten prompt that was actually rendered
1696
- const id = j.axe_identity?.identity_applied ? j.axe_identity : undefined; // the identity broker injected a real face (honest method/fidelity)
1697
- const i2i = !id && j.axe_img2img?.used ? j.axe_img2img : undefined; // pose/style restyle from a reference — NOT the exact face
1698
- await recordMediaGen({ tool: "image_generate", prompt, model: id?.base_model || "flux-schnell", params: { size, n }, refs, ok: true, ...(exp ? { expanded: exp } : {}), ...(id ? { identity: id } : {}), ...(i2i ? { img2img: i2i } : {}) });
1699
- const extra = saved.length && refs.some((r) => /^https?:\/\//.test(r)) ? ` (also saved: ${saved.join(", ")})` : "";
1700
- const expNote = exp ? ` (expanded → "${exp.length > 160 ? exp.slice(0, 160) + "…" : exp}")` : "";
1701
- // Honest provenance in the result: name WHICH reference mechanism actually ran, so likeness is never overclaimed.
1702
- const refNote = id
1703
- ? ` (identity: ${id.method ?? "reference"}${id.base_model ? ` on ${id.base_model}` : ""}${id.fidelity_note ? ` — ${id.fidelity_note}` : ""})`
1704
- : i2i
1705
- ? ` (img2img restyle @ strength ${i2i.strength ?? "?"} — matches pose/composition/style, NOT the exact face)`
1706
- : "";
1707
- return `generated ${refs.length} image${refs.length > 1 ? "s" : ""} (${size}) → ${refs.join(", ")}${extra}${expNote}${refNote}`;
1708
- }
1709
- catch (e) {
1710
- const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1711
- return `error: image worker unreachable at ${base} (${msg}) — start the flux-worker broker (com.axe.flux-worker on the image node). Do NOT load a diffusion model inline; that starves the serving model.`;
1712
- }
1713
- finally {
1714
- clearTimeout(timer);
1715
1672
  }
1716
- }
1717
- // video_generate — same scale-to-zero broker as image_generate (the flux-worker node also serves /v1/video),
1718
- // so generation NEVER runs on the LLM-serving box. Mirrors image_generate's URL-first contract (prefer the
1719
- // broker's public url, fall back to a saved local file) via saveGeneratedMedia. KODE_VIDEO_URL overrides,
1720
- // else it reuses the image endpoints (same broker host).
1721
- /** Candidate video-service endpoints in priority order: KODE_VIDEO_URL first, then the shared image
1722
- * endpoints (the flux-worker broker serves /v1/video alongside /v1/images). De-duped, trailing slash trimmed. */
1723
- function videoEndpoints() {
1724
- const envs = [process.env.KODE_VIDEO_URL].filter(Boolean);
1725
- // The LTX video broker lives at its OWN host (video.axe.onl), not the image host — do NOT fall back to the
1726
- // image endpoints, whose /health is 200 but which 404 on /v1/video (we'd pick a healthy-but-wrong broker).
1727
- // An LTX render takes >100s, which trips the public host's ~100s edge timeout (524): point KODE_VIDEO_URL at a
1728
- // worker on your own network (tried first, no such cap). The public host is the fallback.
1729
- const defaults = ["https://video.axe.onl"];
1730
- return [...new Set([...envs, ...defaults])].map((u) => u.replace(/\/$/, ""));
1731
- }
1673
+ else {
1674
+ if (str(args.reference))
1675
+ Object.assign(genBody, { image: str(args.reference), strength: Number(args.strength ?? 0.65) }); // flux img2img: the reference is the init
1676
+ try {
1677
+ answer = await generate(generationGateways(), "image", genBody, timeoutMs);
1678
+ }
1679
+ catch (e) {
1680
+ return `error: ${e.message}`;
1681
+ }
1682
+ }
1683
+ const j = answer.json;
1684
+ const imgs = j.data ?? [];
1685
+ if (!imgs.length)
1686
+ return "error: image worker returned no image data";
1687
+ const { refs, saved } = await saveGeneratedMedia(imgs, str(args.out), "png");
1688
+ if (!refs.length)
1689
+ return "error: image worker returned no url and no decodable PNG";
1690
+ const exp = j.axe_prompt_expansion?.used ? j.axe_prompt_expansion.expanded : undefined; // the broker-rewritten prompt that was actually rendered
1691
+ const id = j.axe_identity?.identity_applied ? j.axe_identity : undefined; // the identity broker injected a real face (honest method/fidelity)
1692
+ const i2i = !id && j.axe_img2img?.used ? j.axe_img2img : undefined; // pose/style restyle from a reference — NOT the exact face
1693
+ await recordMediaGen({ tool: "image_generate", prompt, model: id?.base_model || answer.backend || "image", params: { size, n }, refs, ok: true, ...(exp ? { expanded: exp } : {}), ...(id ? { identity: id } : {}), ...(i2i ? { img2img: i2i } : {}) });
1694
+ const extra = saved.length && refs.some((r) => /^https?:\/\//.test(r)) ? ` (also saved: ${saved.join(", ")})` : "";
1695
+ const expNote = exp ? ` (expanded → "${exp.length > 160 ? exp.slice(0, 160) + "…" : exp}")` : "";
1696
+ // Honest provenance in the result: name WHICH reference mechanism actually ran, so likeness is never overclaimed.
1697
+ const refNote = id
1698
+ ? ` (identity: ${id.method ?? "reference"}${id.base_model ? ` on ${id.base_model}` : ""}${id.fidelity_note ? ` — ${id.fidelity_note}` : ""})`
1699
+ : i2i
1700
+ ? ` (img2img restyle @ strength ${i2i.strength ?? "?"} — matches pose/composition/style, NOT the exact face)`
1701
+ : "";
1702
+ const via = answer.backend ? ` (via ${answer.backend})` : ""; // which leg rendered it: a fallback leg is a different model
1703
+ return `generated ${refs.length} image${refs.length > 1 ? "s" : ""} (${size}) → ${refs.join(", ")}${extra}${expNote}${refNote}${via}`;
1704
+ }
1705
+ // video_generate — no video leg serves yet, so there is no route behind it: one plain answer instead of a host probe.
1732
1706
  async function videoGenerate(args) {
1733
- const prompt = str(args.prompt);
1734
- if (!prompt)
1707
+ if (!str(args.prompt))
1735
1708
  return "error: video_generate needs a prompt";
1736
- const size = /^\d+x\d+$/.test(str(args.size)) ? str(args.size) : "704x480"; // LTX natural default; the broker rounds w/h to ×32
1737
- const numFrames = Math.max(1, Math.min(Number(args.num_frames) || 97, 257)); // LTX default ≈97 (~4s @ 24fps); broker rounds to 8n+1
1738
- const fps = Math.max(1, Math.min(Number(args.fps) || 24, 60));
1739
- const seed = Number.isFinite(Number(args.seed)) ? Number(args.seed) : undefined;
1740
- const model = str(args.model);
1741
- const refImage = str(args.reference_image); // image-to-video: the broker uses this as LTX first-frame conditioning (path/url or b64)
1742
- const wantExpand = args.expand === true || str(args.expand) === "true";
1743
- // Pick the first reachable endpoint (shared fleet service preferred), failing fast over dead ones.
1744
- const candidates = videoEndpoints();
1745
- let base;
1746
- for (const e of candidates) {
1747
- if (await imageHealthy(e)) {
1748
- base = e;
1749
- break;
1750
- }
1751
- }
1752
- if (!base)
1753
- return `error: no video service reachable (tried ${candidates.join(", ")}). Bring up the flux-worker broker on the image node (it serves /v1/video). Do NOT load a video model inline — that starves the serving model.`;
1754
- const ctrl = new AbortController();
1755
- const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? 600_000)); // a cold video model load + sampling runs minutes, not seconds
1756
- try {
1757
- const res = await fetch(`${base}/v1/video/generations`, {
1758
- method: "POST", signal: ctrl.signal,
1759
- headers: { "Content-Type": "application/json", "User-Agent": "operator/kode-tsi", ...mediaAuth() },
1760
- body: JSON.stringify({ prompt, size, num_frames: numFrames, fps, ...(seed != null ? { seed } : {}), ...(model ? { model } : {}), ...(refImage ? { image: refImage } : {}), ...(wantExpand ? { expand: true } : {}) }),
1761
- });
1762
- if (!res.ok)
1763
- return `error: video worker returned ${res.status} — ensure the flux-worker broker serves /v1/video (video_gen.py)`;
1764
- const j = (await res.json().catch(() => ({})));
1765
- const vids = j.data ?? [];
1766
- if (!vids.length)
1767
- return "error: video worker returned no video data";
1768
- const { refs, saved } = await saveGeneratedMedia(vids, str(args.out), "mp4");
1769
- if (!refs.length)
1770
- return "error: video worker returned no url and no decodable video";
1771
- const exp = j.axe_prompt_expansion?.used ? j.axe_prompt_expansion.expanded : undefined;
1772
- await recordMediaGen({ tool: "video_generate", prompt, model: model || "ltx-video", params: { size, num_frames: numFrames, fps, ...(seed != null ? { seed } : {}) }, refs, ok: true, ...(refImage ? { conditioned: j.conditioned !== false } : {}), ...(exp ? { expanded: exp } : {}) });
1773
- const extra = saved.length && refs.some((r) => /^https?:\/\//.test(r)) ? ` (also saved: ${saved.join(", ")})` : "";
1774
- const condNote = refImage ? (j.conditioned !== false ? " (image-conditioned)" : " (reference ignored — broker not image-conditioned yet)") : "";
1775
- const expNote = exp ? ` (expanded → "${exp.length > 160 ? exp.slice(0, 160) + "…" : exp}")` : "";
1776
- return `generated ${refs.length} video${refs.length > 1 ? "s" : ""} (${size}, ${numFrames}f @ ${fps}fps) → ${refs.join(", ")}${extra}${condNote}${expNote}`;
1777
- }
1778
- catch (e) {
1779
- const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1780
- return `error: video worker unreachable at ${base} (${msg}) — start the flux-worker broker (it serves /v1/video on the image node). Do NOT load a video model inline; that starves the serving model.`;
1781
- }
1782
- finally {
1783
- clearTimeout(timer);
1784
- }
1709
+ return "error: video generation isn't available yet";
1785
1710
  }
1786
1711
  async function visionSettings() {
1787
1712
  const { loadSettings } = await nodeImport("../config/settings.js"); // variable-specifier load keeps settings out of the browser graph
@@ -1901,7 +1826,7 @@ async function flattenAlpha(image) {
1901
1826
  return image;
1902
1827
  }
1903
1828
  }
1904
- async function visionImageDataUrl(image, lim) {
1829
+ export async function visionImageDataUrl(image, lim) {
1905
1830
  image = await absMediaPath(image);
1906
1831
  if (/^https?:\/\//.test(image))
1907
1832
  image = await fetchImageToTemp(image);
@@ -1929,7 +1854,7 @@ async function visionImageDataUrl(image, lim) {
1929
1854
  const { stdout } = await pexec("sips", ["-g", "pixelWidth", "-g", "pixelHeight", image]);
1930
1855
  const w = Number((/pixelWidth:\s*(\d+)/.exec(stdout) || [])[1] || 0);
1931
1856
  const h = Number((/pixelHeight:\s*(\d+)/.exec(stdout) || [])[1] || 0);
1932
- if (w && h && buf.length < w * h * BLANK_BYTES_PER_PX) {
1857
+ if (!lim.keepBlank && w && h && buf.length < w * h * BLANK_BYTES_PER_PX) {
1933
1858
  const flat = await flatColour(pexec, image, join(dir, "t.bmp"));
1934
1859
  if (flat)
1935
1860
  return { blank: `${w}×${h}, one flat colour ${flat}, ${Math.max(1, Math.round(buf.length / 1024))} KB` };
@@ -2317,7 +2242,11 @@ async function imageRecreate(args) {
2317
2242
  async function artifactCreate(args) {
2318
2243
  const temple = (await nodeImport("../products/temple.js"));
2319
2244
  const paths = Array.isArray(args.paths) ? args.paths.map(String).filter(Boolean) : [];
2320
- const visibility = /^(private|link|public)$/.test(str(args.visibility)) ? str(args.visibility) : "link";
2245
+ const { loadSettings } = await nodeImport("../config/settings.js");
2246
+ const vis = artifactVisibility(loadSettings().permissions?.tier, args.visibility, true);
2247
+ if ("error" in vis)
2248
+ return `error: ${vis.error}`;
2249
+ const visibility = vis.visibility;
2321
2250
  const r = await temple.publish({ title: str(args.title) || "Operator artifact", content: str(args.content) || undefined, content_type: str(args.content_type) || undefined, kind: str(args.kind) || undefined, paths, visibility });
2322
2251
  if (!r.ok)
2323
2252
  return `error: ${r.error}${/reach|timed out/.test(r.error) ? " — if this persists, write a local file with file_create instead" : ""}`;
@@ -2797,13 +2726,13 @@ const TOOLS = [
2797
2726
  expand: { type: "boolean", description: "rewrite the prompt richer first (the quality lever)" },
2798
2727
  steps: { type: "number", description: "default 4; ~8 for finer img2img" },
2799
2728
  out: { type: "string", description: ".png path (default temp)" },
2800
- timeout_ms: { type: "number", description: "default 180000" },
2729
+ timeout_ms: { type: "number", description: "default 600000" },
2801
2730
  }, required: ["prompt"] },
2802
2731
  run: imageGenerate,
2803
2732
  },
2804
2733
  {
2805
2734
  name: "video_generate",
2806
- description: "Generate a short video (AXE video worker, LTX-Video, scale-to-zero) → a renderable URL or .mp4 path. Never load a video model inline — that pins GBs on the serving box and crawls your decode.",
2735
+ description: "Not available yet: no video service is connected, so this returns that answer. Use image_generate for stills. Never load a video model inline — that pins GBs on the serving box and crawls your decode.",
2807
2736
  parameters: { type: "object", properties: {
2808
2737
  prompt: { type: "string", description: "what to generate" },
2809
2738
  size: { type: "string", description: "WxH (default \"704x480\")" },
@@ -2813,7 +2742,7 @@ const TOOLS = [
2813
2742
  reference_image: { type: "string", description: "first-frame image path/url (image-to-video)" },
2814
2743
  expand: { type: "boolean", description: "rewrite the prompt richer first" },
2815
2744
  out: { type: "string", description: ".mp4 path (default temp)" },
2816
- timeout_ms: { type: "number", description: "default 600000" },
2745
+ timeout_ms: { type: "number", description: "default 900000" },
2817
2746
  }, required: ["prompt"] },
2818
2747
  run: videoGenerate,
2819
2748
  },
@@ -3447,10 +3376,12 @@ export function cloudAgentToolsFor(settings) {
3447
3376
  export function mdocToolsFor(settings) {
3448
3377
  return isFeatureEnabled("mdoc", settings ?? undefined) ? MDOC_TOOLS : [];
3449
3378
  }
3450
- // Flag-gated craft product tools (config/features.ts `craft`): absent from the base registry so the stock prompt
3451
- // prefix is unchanged; the session adds them only when the `craft` feature is on, exactly like mdoc + cloud-agent.
3379
+ // The artifact library (craft_list/get/update/delete) is on for every seat (2026-11-29): artifact_create makes an
3380
+ // artifact, these find and change it, so nobody has to add an MCP server to manage their own work. With deferred
3381
+ // tools (default on) they cost nothing in the cached prefix. craft_create stays behind the `craft` flag: it
3382
+ // duplicates artifact_create, the one way to make an artifact.
3452
3383
  export function craftToolsFor(settings) {
3453
- return isFeatureEnabled("craft", settings ?? undefined) ? CRAFT_TOOLS : [];
3384
+ return isFeatureEnabled("craft", settings ?? undefined) ? CRAFT_TOOLS : CRAFT_TOOLS.filter(t => t.name !== "craft_create");
3454
3385
  }
3455
3386
  export function toSchemas(reg = registry) {
3456
3387
  return [...reg.values()].map(t => ({
package/dist/ui/App.js CHANGED
@@ -4,7 +4,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
4
4
  // src/engine, src/tools, or src/router.
5
5
  import React, { useEffect, useRef, useState } from "react";
6
6
  import { Box, Text, measureElement, useInput } from "ink";
7
- import { useTerminalSize, termCols } from "./term.js";
7
+ import { useTerminalSize, termCols, termRows } from "./term.js";
8
8
  import { caps } from "./capabilities.js";
9
9
  import { MouseProvider, useOnWheel, useMouse } from "./MouseProvider.js";
10
10
  import { StatusRule } from "./StatusRule.js";
@@ -91,8 +91,19 @@ function ExpandKey({ onExpand, active }) {
91
91
  return null;
92
92
  }
93
93
  export function App(props) {
94
- const { messages, live = null, status, thinkingVerb, verbs, stepLabel, phase = null, fold = null, delegate = null, liveTools = [], route, ctxPct, ctxWindow, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], mainLane = null, mainServing, maxRunning, onBackground, tasks = [], planNow, onSubmit, onQueue, onSteer, pending = [], onEditQueued, onDropQueued, nextSteps, onPickNext, onDismissNext, agents = [], onAgentMessage, conversations = [], switcher, onSwitcher, onFocusSwitcher, conversationPane = null, onSendTo, actOffer = null, onActNow, finder = null, onOpenFinder, onInterrupt, onExpand, onCycleMode, onCycleContext, opMode, rcConnected = false, rcActive = false, caffeinated = false, approval = null, onApprovalDecide, question = null, modelPicker = null, secretPrompt = null, planExitPicker = null, artifactsPicker = null, sessionsPicker = null, update = null } = props;
94
+ const { messages, live = null, status, thinkingVerb, verbs, stepLabel, phase = null, fold = null, delegate = null, liveTools = [], route, ctxPct, ctxWindow, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], mainLane = null, mainServing, maxRunning, lanePool, laneWarnings, onBackground, tasks = [], planNow, onSubmit, onQueue, onSteer, pending = [], onEditQueued, onDropQueued, nextSteps, onPickNext, onDismissNext, agents = [], onAgentMessage, conversations = [], switcher, onSwitcher, onFocusSwitcher, conversationPane = null, onSendTo, actOffer = null, onActNow, finder = null, onOpenFinder, onInterrupt, onExpand, onCycleMode, onCycleContext, opMode, rcConnected = false, rcActive = false, caffeinated = false, approval = null, onApprovalDecide, question = null, modelPicker = null, secretPrompt = null, planExitPicker = null, artifactsPicker = null, sessionsPicker = null, update = null } = props;
95
95
  const cols = useTerminalSize().cols; // subscribe so the inline pinned UI (status rule, composer, footer) reflows the instant the terminal resizes
96
+ // Inline: the height of everything under the live entry (spinner, plan, lanes, prompts, composer), measured after
97
+ // each layout. The live entry gets only the rows left over, so the dynamic frame never reaches the terminal height.
98
+ const chromeRef = useRef(null);
99
+ const [chromeRows, setChromeRows] = useState(undefined);
100
+ useEffect(() => {
101
+ if (fullscreen || !chromeRef.current)
102
+ return;
103
+ const { height } = measureElement(chromeRef.current);
104
+ if (height !== chromeRows)
105
+ setChromeRows(height);
106
+ });
96
107
  const thinking = status === "thinking" || status === "streaming";
97
108
  // Tool rows exist before their calls run (TUI plan #8): from the first streamed argument (drafting) through waiting
98
109
  // its turn to running and settled — one row per call, a lone call included, instead of the bare "⠋ name…".
@@ -102,7 +113,7 @@ export function App(props) {
102
113
  const activity = (_jsxs(_Fragment, { children: [showSpinner && (_jsx(Box, { marginTop: 1, marginBottom: showLiveRows ? 0 : 1, children: status === "recovering" || status === "compacting" ? _jsx(RecoverSpinner, { active: true, label: stepLabel })
103
114
  : status === "executing" && !showLiveRows ? _jsx(StepSpinner, { active: true, label: stepLabel })
104
115
  : _jsx(ThinkingSpinner, { active: true, verb: status === "executing" ? thinkingVerb ?? "Running" : thinkingVerb, verbs: verbs, metrics: metrics }) })), showLiveRows && (_jsxs(Box, { flexDirection: "column", marginTop: 1, marginBottom: 1, paddingLeft: 1, children: [_jsx(Text, { dimColor: true, children: batchHeader(liveTools, termCols()) }), liveTools.slice(0, MAX_LIVE_TOOL_ROWS).map((step) => (_jsxs(React.Fragment, { children: [_jsx(LiveRow, { step: step }), delegate && step.id === delegateRow(liveTools, delegate) ? _jsx(DelegateChild, { view: delegate }) : null] }, step.id))), liveTools.length > MAX_LIVE_TOOL_ROWS ? _jsxs(Text, { dimColor: true, children: [" +", liveTools.length - MAX_LIVE_TOOL_ROWS, " more\u2026"] }) : null] })), fold ? (() => { const line = foldLine(fold, termCols(), true); return _jsxs(Text, { children: [_jsx(Text, { color: theme.blocked, children: line.slice(0, 1) }), _jsx(Text, { dimColor: true, children: line.slice(1) })] }); })() : null, _jsx(PlanPane, { tasks: tasks, now: planNow }), liveWorkers(mainLane, bgAgents, shellJobs) >= 2
105
- ? _jsx(Lanes, { main: mainLane, agents: bgAgents, jobs: shellJobs, mainServing: mainServing, maxRunning: maxRunning })
116
+ ? _jsx(Lanes, { main: mainLane, agents: bgAgents, jobs: shellJobs, mainServing: mainServing, maxRunning: maxRunning, pool: lanePool, warnings: laneWarnings })
106
117
  : _jsx(BgPanel, { agents: bgAgents, jobs: shellJobs }), (thinking || status === "executing" || status === "recovering" || status === "compacting") && (_jsx(PhaseLine, { view: phase ?? { phase: status === "executing" ? "tools" : status === "recovering" ? "recovering" : status === "compacting" ? "compacting" : status === "streaming" ? "writing" : "waiting", label: stepLabel }, rows: liveTools, offer: actOffer }))] }));
107
118
  // One input owner at a time. An open overlay — the finder, the focused switcher — keeps the keyboard; a prompt that
108
119
  // arrives under it (an approval, an ask_user, the plan review) is drawn, waiting, and answered only once the overlay
@@ -136,7 +147,7 @@ export function App(props) {
136
147
  // but DEMAND-DRIVEN — the provider only turns SGR tracking on while an overlay (picker/approval) is open,
137
148
  // so the terminal's native scrollback (wheel-scroll + drag-to-copy) is untouched the rest of the time.
138
149
  // The composer is measured (MeasuredComposer) so an open picker's click anchor knows what sits below it.
139
- return (_jsx(MouseProvider, { enabled: caps().mouse, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Transcript, { entries: messages, live: live }), activity, _jsxs(MeasuredStack, { children: [prompts, bottom] })] }) }));
150
+ return (_jsx(MouseProvider, { enabled: caps().mouse, children: _jsxs(Box, { flexDirection: "column", children: [_jsx(Transcript, { entries: messages, live: live, liveRows: chromeRows === undefined ? undefined : termRows() - chromeRows - 1 }), _jsxs(Box, { ref: chromeRef, flexDirection: "column", children: [activity, _jsxs(MeasuredStack, { children: [prompts, bottom] })] })] }) }));
140
151
  }
141
152
  // Keys while the conversation switcher has focus (the composer is suspended meanwhile): ←/→ (or ↓) pick, Enter opens,
142
153
  // ↑ or Esc hands the keyboard back to the composer.
@@ -6,6 +6,8 @@ import { useTick } from "./tick.js";
6
6
  import { termCols, termRows } from "./term.js";
7
7
  import { cellWidth, truncateToWidth } from "./StatusRule.js";
8
8
  import { fmtElapsed, fmtTok } from "./format.js";
9
+ import { laneSummary } from "../background/lane-summary.js";
10
+ import { deadlineText } from "../background/synthesis.js";
9
11
  const GLYPH = { queued: "◌", working: "●", idle: "✓", stopped: "✗" };
10
12
  const COLOR = { queued: theme.muted, working: theme.running, idle: theme.success, stopped: theme.error };
11
13
  const DISPLAY_STATUS = { queued: "queued", working: "running", idle: "done", stopped: "errored" };
@@ -86,7 +88,7 @@ export function detailLine(a) {
86
88
  if (a.status === "stopped")
87
89
  return { text: a.endReason ?? "errored — check transcript for details", tone: "dim" };
88
90
  if (a.status === "queued")
89
- return { text: "waiting for a free slot", tone: "dim" };
91
+ return { text: a.queueReason ? `waiting: ${a.queueReason}` : "waiting for a free slot", tone: "dim" };
90
92
  const steps = a.steps ?? [];
91
93
  const stepLine = steps.slice(-3).map((s) => s.name + (s.arg ? `(${s.arg})` : "") + (s.running ? " …" : "")).join(" · ");
92
94
  const head = stepLine ? `↳ ${stepLine}` : a.thought ? `⋮ ${a.thought.replace(/^…/, "").trim()}` : "";
@@ -170,8 +172,10 @@ export function agentLaneOf(a, now, ctx = {}) {
170
172
  const base = { key: a.id, name: a.name ?? a.id, role: `${a.title ?? "sub-agent"}${a.resumed ? " · resumed" : ""}`, elapsedMs, tokens: a.tokens };
171
173
  const ledger = [a.written?.length ? `wrote ${a.written.length}` : "", a.reads ? `read ${a.reads}` : "", a.commands ? `ran ${a.commands}` : ""].filter(Boolean).join(" · ");
172
174
  const join = (...xs) => xs.filter(Boolean).join(" · ");
173
- if (a.status === "queued")
174
- return { ...base, tone: "queued", mission: ctx.maxRunning ? `queued: ${ctx.running ?? ctx.maxRunning} of ${ctx.maxRunning} agent slots busy` : "queued for a free agent slot" };
175
+ if (a.status === "queued") {
176
+ const why = a.queueReason ?? (ctx.maxRunning ? `${ctx.running ?? ctx.maxRunning} of ${ctx.maxRunning} agent slots busy` : "waiting for a free agent slot");
177
+ return { ...base, tone: "queued", mission: join(`waiting${a.phase?.kind === "queued" ? ` ${fmtElapsed(now - a.phase.since)}` : ""}: ${why}`, deadlineText(a, now)) };
178
+ }
175
179
  if (a.status === "idle")
176
180
  return { ...base, tone: "done", mission: join("done", a.verified === true ? "✓ verified" : a.verified === false ? "✗ unverified" : undefined, a.written?.length ? `wrote ${a.written.slice(-1).map((p) => p.split("/").pop()).join("")}` : undefined, "report delivered") };
177
181
  if (a.status === "stopped") {
@@ -183,8 +187,8 @@ export function agentLaneOf(a, now, ctx = {}) {
183
187
  if (a.slotWaitSince !== undefined) {
184
188
  return { ...base, tone: "waiting", mission: join(`waiting ${fmtElapsed(now - a.slotWaitSince)}: ${a.model ?? "its model"}'s slot is held by ${holderShort(a.slotHolder)}`, ledger || undefined) };
185
189
  }
186
- const where = a.model && ctx.mainServing ? (a.model === ctx.mainServing ? "shares main's slot" : "own server") : undefined;
187
- return { ...base, tone: "working", mission: join(a.round ? `r${a.round}` : undefined, missionLine(a), ledger || undefined, where) };
190
+ // What it is doing in plain words; the backend explains only a wait, so it stays out of a working lane (/agents <id>).
191
+ return { ...base, tone: "working", mission: join(a.round ? `r${a.round}` : undefined, laneSummary(a, now), deadlineText(a, now), a.evidence ? "⚠ shared input" : undefined, ledger || undefined) };
188
192
  }
189
193
  export function jobLaneOf(j, now) {
190
194
  const tone = j.status === "running" ? "job" : j.status === "done" ? "jobDone" : "jobFailed";
@@ -208,11 +212,12 @@ export function laneRow(l, cols) {
208
212
  const mission = truncateToWidth(l.mission, Math.max(0, room));
209
213
  return { left, mission: mission + " ".repeat(Math.max(0, room - cellWidth(mission))), right };
210
214
  }
211
- /** The lanes header: counts, a rule, and the commands that act on them (dropped under 80 cols) — cols−1 wide. */
212
- export function laneHeader(lanes, cols) {
215
+ /** The lanes header: counts, the live pool when the router reports one, a rule, and the commands that act on them
216
+ * (dropped under 80 cols) — cols−1 wide. */
217
+ export function laneHeader(lanes, cols, pool) {
213
218
  const n = (t) => lanes.filter((l) => t.includes(l.tone)).length;
214
219
  const running = n(["main", "working", "stuck"]), waiting = n(["waiting"]), queued = n(["queued"]), jobs = n(["job"]);
215
- const counts = [`${lanes.length} lanes`, running ? `${running} running` : "", waiting ? `${waiting} waiting for a slot` : "", queued ? `${queued} queued` : "", jobs ? `${jobs} shell job${jobs === 1 ? "" : "s"}` : ""].filter(Boolean).join(" · ");
220
+ const counts = [`${lanes.length} lanes`, running ? `${running} running` : "", waiting ? `${waiting} waiting for a slot` : "", queued ? `${queued} queued` : "", jobs ? `${jobs} shell job${jobs === 1 ? "" : "s"}` : "", pool ?? ""].filter(Boolean).join(" · ");
216
221
  const hint = cols >= 80 ? " /agents · /jobs" : "";
217
222
  const head = truncateToWidth(` ⇶ ${counts} `, cols - 1 - cellWidth(hint) - 1);
218
223
  return head + "─".repeat(Math.max(1, cols - 1 - cellWidth(head) - cellWidth(hint))) + hint;
@@ -224,7 +229,7 @@ function LaneRow({ lane, cols }) {
224
229
  return (_jsxs(Text, { children: [" ", lane.tone === "working" ? _jsx(OrbitGlyph, {}) : _jsx(Text, { color: LANE_COLOR[lane.tone], children: LANE_GLYPH[lane.tone] }), " ", _jsx(Text, { bold: true, children: left.slice(0, 6) }), _jsx(Text, { dimColor: true, children: left.slice(6) }), _jsx(Text, { color: lane.tone === "stuck" ? theme.warn : undefined, dimColor: lane.tone !== "stuck" && lane.tone !== "main" && lane.tone !== "working", children: mission }), right ? _jsx(Text, { dimColor: true, children: ` ${right}` }) : null] }));
225
230
  }
226
231
  /** The lanes view: one row per live worker, finished agents lingering until they are reaped. */
227
- export function Lanes({ main, agents, jobs, mainServing, maxRunning }) {
232
+ export function Lanes({ main, agents, jobs, mainServing, maxRunning, pool, warnings = [] }) {
228
233
  const cols = termCols();
229
234
  const now = Date.now();
230
235
  const running = agents.filter((a) => a.status === "working").length;
@@ -236,5 +241,5 @@ export function Lanes({ main, agents, jobs, mainServing, maxRunning }) {
236
241
  ];
237
242
  const cap = termRows() < LANES_SHORT_ROWS ? 3 : 8;
238
243
  const shown = lanes.slice(0, cap);
239
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { dimColor: true, children: laneHeader(lanes, cols) }), shown.map((l) => _jsx(LaneRow, { lane: l, cols: cols }, l.key)), lanes.length > shown.length ? _jsx(Text, { dimColor: true, children: ` +${lanes.length - shown.length} more · /agents` }) : null] }));
244
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { dimColor: true, children: laneHeader(lanes, cols, pool) }), shown.map((l) => _jsx(LaneRow, { lane: l, cols: cols }, l.key)), warnings.slice(0, 1).map((w) => _jsx(Text, { color: theme.warn, wrap: "truncate-end", children: ` ⚠ ${w}` }, w)), lanes.length > shown.length ? _jsx(Text, { dimColor: true, children: ` +${lanes.length - shown.length} more · /agents` }) : null] }));
240
245
  }
package/dist/ui/Header.js CHANGED
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from "ink";
3
3
  import { termCols } from "./term.js";
4
4
  import { theme } from "./theme.js";
5
+ import { prettyRoute } from "./StatusRule.js"; // the ONE outward-name rule, shared with the status rule
5
6
  const STAR = "✷"; // ✷ — the AXE signal star (brand glyph, matches ThinkingSpinner)
6
7
  function tierLabel(ctx) {
7
8
  if (!ctx)
@@ -12,12 +13,6 @@ function tierLabel(ctx) {
12
13
  return `${Math.round(ctx / 1024)}K`; // /1024 so 307200→"300K", 131072→"128K" (KiB-tokens, truthful)
13
14
  return String(ctx);
14
15
  }
15
- // The status line shows the OUTWARD name only: the internal model ids (operator-1m, or the legacy
16
- // aurora-* alias) collapse to "Operator" — the tier (· 1M) is appended separately below, so
17
- // "operator-1m" would just be redundant. MOA and any custom /model id pass through unchanged.
18
- function prettyRoute(r) {
19
- return /^(operator|aurora)(-|$)/i.test(r) ? "Operator" : r;
20
- }
21
16
  export function Header({ version, route = "operator", ctxWindow, user, build }) {
22
17
  const cols = termCols();
23
18
  const tier = tierLabel(ctxWindow);
@@ -3,6 +3,7 @@ import { Box, Text } from "ink";
3
3
  import { termCols } from "./term.js";
4
4
  import { theme } from "./theme.js";
5
5
  import { ring } from "./chart.js";
6
+ import { opsModeOn } from "./opsMode.js";
6
7
  // Compact token count for the status rule: 1234 -> "1.2k", 45231 -> "45k", 800 -> "800".
7
8
  function fmtK(n) {
8
9
  if (n < 1000)
@@ -44,10 +45,18 @@ export function truncateToWidth(s, max) {
44
45
  // the terminal is too narrow to hold every badge, `info` is truncated so cellWidth(right) ≤ cols-3 —
45
46
  // which keeps the leading fill ≥ 1 and the whole line at cols-1, so the rule never becomes the line that
46
47
  // wraps (the creep bug) no matter how many badges are lit or how narrow the window.
47
- const ROUTE_LABELS = { "operator-1m": "aurora" };
48
- /** The model as the owner reads it everywhere ("cortana"; the default operator-1m reads "aurora"). */
48
+ // The OUTWARD name only. Every Operator-branded model id (operator-1m, operator-flash, the legacy
49
+ // aurora-* aliases) reads "Operator" — the tier badge beside it carries the window, so the id would add
50
+ // nothing. A retired name is never shown for a live model: the hardcoded "operator-1m → aurora" map
51
+ // printed "aurora" while Operator-Flash was answering (owner screenshot, 11/26). Any other id — a fleet
52
+ // row, a BYO endpoint, MOA — passes through unchanged, because inventing a name for a model we know
53
+ // nothing about is worse than showing its id.
54
+ export function prettyRoute(r) {
55
+ return /^(operator|aurora)(-|$)/i.test(r) ? "Operator" : r;
56
+ }
57
+ /** The model as the owner reads it everywhere — the one label function every surface calls. */
49
58
  export function routeLabel(route) {
50
- return ROUTE_LABELS[route] ?? route;
59
+ return prettyRoute(route);
51
60
  }
52
61
  export function statusRight(p, cols) {
53
62
  const who = p.user ? `◆ ${p.user} · ` : "";
@@ -61,12 +70,13 @@ export function statusRight(p, cols) {
61
70
  // its id operator-1m (owner, 11/03: "just aurora 300k"), and the window is the one served, not a pin above it.
62
71
  const window = p.ctxWindow ? ` ${p.ctxWindow}` : "";
63
72
  let info = `${think}${plan}${seat}${who}${routeLabel(p.route)}${window} ${ring(p.ctxPct)} ${Math.round(p.ctxPct)}% · ${tok}v${p.version}${p.build ? ` ·${p.build}` : ""}`;
64
- let right = `✷ OPERATOR · ${info} ─`;
73
+ const word = p.ops ? "OPS" : "OPERATOR";
74
+ let right = `✷ ${word} · ${info} ─`;
65
75
  const maxRight = cols - 3; // leaves fill ≥ 1 and total = cols-1
66
76
  if (cellWidth(right) > maxRight) {
67
77
  const framing = cellWidth(right) - cellWidth(info); // the wordmark + separators + trailing " ─"
68
78
  info = truncateToWidth(info, maxRight - framing);
69
- right = `✷ OPERATOR · ${info} ─`;
79
+ right = `✷ ${word} · ${info} ─`;
70
80
  }
71
81
  return { info, right };
72
82
  }
@@ -79,9 +89,10 @@ export function ruleFill(right, cols) {
79
89
  }
80
90
  export function StatusRule(props) {
81
91
  const cols = termCols();
82
- const { info, right } = statusRight(props, cols);
92
+ const ops = props.ops ?? opsModeOn();
93
+ const { info, right } = statusRight({ ...props, ops }, cols);
83
94
  const fill = ruleFill(right, cols);
84
95
  // Enterprise header: a dim rule sweeping to a magenta ✷ mark + bright OPERATOR wordmark + dim info,
85
96
  // sitting just above the composer (the input is bounded between this and the InputRule below).
86
- return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "─".repeat(fill) + " " }), _jsx(Text, { color: theme.accent, children: "\u2737 " }), _jsx(Text, { bold: true, children: "OPERATOR" }), _jsx(Text, { dimColor: true, children: ` · ${info} ─` })] }));
97
+ return (_jsxs(Box, { children: [_jsx(Text, { dimColor: true, children: "─".repeat(fill) + " " }), _jsx(Text, { color: theme.accent, children: "\u2737 " }), _jsx(Text, { bold: true, children: ops ? "OPS" : "OPERATOR" }), _jsx(Text, { dimColor: true, children: ` · ${info} ─` })] }));
87
98
  }
@@ -5,6 +5,7 @@ import { fileLink } from "./osc.js";
5
5
  import { theme } from "./theme.js";
6
6
  import { computeEditDiff } from "./editdiff.js";
7
7
  import { useTick } from "./tick.js";
8
+ import { SHELL_ANY } from "../tools/classes.js";
8
9
  import { rowBackgroundHint, BULK_ARGS } from "./liveTools.js";
9
10
  import { glyphFor, toolKind, KIND_HUE } from "./toolicons.js";
10
11
  import { renderSweepBar } from "./progressbar.js";
@@ -19,7 +20,6 @@ const COLOR = { selected: theme.muted, running: theme.running, done: theme.succe
19
20
  // (never truncated), so you can always read the exact file name / path a tool wrote or read. Order matters:
20
21
  // path-like keys first.
21
22
  const KEY_ARGS = ["path", "file", "filename", "command", "cmd", "pattern", "url", "query", "workspace", "cwd", "name"];
22
- const SHELL_TOOLS = new Set(["bash", "shell_exec", "shell_background"]);
23
23
  /** `link: false` gives the plain text (a live row clips it, and clipping an OSC-8 escape cuts it); `sizes` are a
24
24
  * draft's bulk arguments by their running length, shown where the finished call shows its own. */
25
25
  export function argsPreview(args, opts = {}) {
@@ -65,7 +65,7 @@ export function argsPreview(args, opts = {}) {
65
65
  /** The call's title. A shell call reads as the command itself — "$ ls -la /path" — like a terminal prompt (owner, 10/31:
66
66
  * "bash needs to just show $"); every other tool reads name(args). `note` is the shell call's description, shown dim. */
67
67
  export function stepTitle(step) {
68
- if (SHELL_TOOLS.has(step.name) && typeof step.args?.command === "string") {
68
+ if (SHELL_ANY.has(step.name) && typeof step.args?.command === "string") {
69
69
  const cmd = step.args.command.replace(/\s+/g, " ").trim();
70
70
  const desc = typeof step.args.description === "string" && step.args.description.trim() ? step.args.description.trim() : undefined;
71
71
  return { head: "$", body: cmd.length > 160 ? cmd.slice(0, 157) + "..." : cmd, note: desc };
@@ -74,7 +74,7 @@ export function stepTitle(step) {
74
74
  }
75
75
  /** For shell tools with a description, the command is shown dim beneath the description line. */
76
76
  export function shellCommandHint(step) {
77
- if (!SHELL_TOOLS.has(step.name) || !step.args?.description)
77
+ if (!SHELL_ANY.has(step.name) || !step.args?.description)
78
78
  return null;
79
79
  const cmd = step.args.command;
80
80
  if (typeof cmd !== "string")