@0perator/operator 0.1.274 → 0.1.276

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.
@@ -11,9 +11,7 @@ import { listLocalSkills, localSkillsDir as profileSkillsDir, resolveSkillFile }
11
11
  import { operatorPath } from "../config/home.js";
12
12
  import { pexecFile } from "./exec.js";
13
13
  import { formatGitStatus } from "./git-status.js";
14
- import { POWER_TOOLS, disabledPowerToolNames } from "./power-tools.js";
15
14
  import { expandPath } from "./paths.js";
16
- import { nativeToolRedirect } from "./native-redirect.js";
17
15
  import { runMemoryTool } from "./memory.js";
18
16
  import { runCronTool } from "../autonomy/cron.js";
19
17
  import { runDelegateTask } from "../autonomy/delegate.js";
@@ -65,17 +63,10 @@ export function disposeShellSessionKey(key) {
65
63
  _shells.delete(key);
66
64
  }
67
65
  }
68
- // Redirect-once memory for nativeToolRedirect (tools/native-redirect.ts): the commands it already pointed at a
69
- // native tool, so the identical re-issue (a legitimate non-media install) is let through. Shared by shell_exec
70
- // and shell_background — one attempt ledger, whichever door the model uses.
71
- const nativeRedirectSeen = new Set();
72
66
  async function shellExec(args) {
73
67
  const command = str(args.command);
74
68
  if (!command)
75
69
  return "error: no command given";
76
- const redirect = nativeToolRedirect(command, nativeRedirectSeen);
77
- if (redirect)
78
- return redirect; // "you already have image_generate" — a tool RESULT, never run, never a 2nd system message
79
70
  const timeout = Number(args.timeout_ms ?? 120_000);
80
71
  // A `cwd` arg is scoped to this one call (subshell) so it doesn't silently move the persistent
81
72
  // session's directory; an explicit `cd` INSIDE the command persists, exactly like a terminal.
@@ -797,7 +788,13 @@ async function emailSend(args) {
797
788
  let to = str(args.to).trim().toLowerCase();
798
789
  if (!to) {
799
790
  try {
800
- const { loadCredentials } = await import("../auth/store.js");
791
+ // OPAQUE specifier: a LITERAL dynamic-import specifier is followed by esbuild into the
792
+ // platform:neutral iOS/web bundle (tools/registry is reachable from index.browser via
793
+ // permissions/tier), and auth/store statically imports node:child_process — the neutral
794
+ // gate hard-fails on it (this shipped red on main: the committed bundle predates the leak).
795
+ // Same non-analyzable trick as the `ws` / node:fs fallbacks. Node still resolves it fine.
796
+ const storeSpec = "../auth/store.js";
797
+ const { loadCredentials } = await import(storeSpec);
801
798
  const creds = await loadCredentials().catch(() => null);
802
799
  to = (creds?.user ?? "").toLowerCase(); // email sign-in: external_id == the owner's email
803
800
  }
@@ -973,9 +970,6 @@ async function shellBackground(args) {
973
970
  const command = str(args.command);
974
971
  if (!command)
975
972
  return "error: no command given";
976
- const redirect = nativeToolRedirect(command, nativeRedirectSeen);
977
- if (redirect)
978
- return redirect;
979
973
  pruneBgJobs();
980
974
  const running = [...bgJobs.values()].filter((j) => !j.done).length;
981
975
  if (running >= BG_MAX_RUNNING)
@@ -1125,15 +1119,6 @@ function mediaAuth() {
1125
1119
  const t = process.env.KODE_MEDIA_TOKEN;
1126
1120
  return t ? { Authorization: `Bearer ${t}` } : {};
1127
1121
  }
1128
- /** Failure semantics for every media/vision/voice worker error: a worker that does not answer is an OUTAGE of a
1129
- * shared fleet service, not a missing capability. Said in the tool result so the model retries/reports instead
1130
- * of "working around" the tool by installing ComfyUI/diffusers/a CLI and pulling weights onto the serving box
1131
- * (live aurora session 10-09: the old "Bring up the flux-worker" wording + the loop nudge's "work around it"
1132
- * became a mandate to build a stack). `what` = "image"|"video"|"vision"|"voice"; `tool` = the tool to keep using. */
1133
- function outage(what, tool) {
1134
- return `${what} service is DOWN (outage): retry once; if still down, TELL THE OWNER. Do NOT install ComfyUI/diffusers/CLIs ` +
1135
- `or download model weights to substitute — the capability already exists as \`${tool}\`.`;
1136
- }
1137
1122
  /** Is an image endpoint reachable + ready? Fast /health probe so we fail over off a dead endpoint BEFORE
1138
1123
  * committing to a ~tens-of-seconds generation, instead of hanging the whole turn on it. */
1139
1124
  async function imageHealthy(base) {
@@ -1209,20 +1194,16 @@ async function imageGenerate(args) {
1209
1194
  const prompt = str(args.prompt);
1210
1195
  if (!prompt)
1211
1196
  return "error: image_generate needs a prompt";
1197
+ const size = /^\d+x\d+$/.test(str(args.size)) ? str(args.size) : "512x512";
1212
1198
  const n = Math.max(1, Math.min(Number(args.n) || 1, 4));
1213
1199
  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)
1214
1200
  // Route reference-bearing requests to the IDENTITY broker (preserve a SPECIFIC face via IP-Adapter-FaceID);
1215
1201
  // plain text-to-image stays on flux. Try identity first when a reference is given, fall back to flux if the
1216
1202
  // identity node is asleep — a request never hard-fails just because one broker is down.
1217
- // `quality:"photoreal"` ALSO goes to the identity broker, with NO reference: its worker runs plain RealVisXL
1218
- // (SDXL) text-to-image when no face is given (identity_applied:false) — the photoreal text-only path, so a
1219
- // model that wants photoreal calls this tool instead of building its own SDXL/ComfyUI stack. Fast flux-schnell
1220
- // stays the default; photoreal that cannot reach the identity broker falls back to flux and SAYS so.
1221
1203
  const wantIdentity = !!str(args.reference);
1222
- const wantPhotoreal = /^photo-?real(?:istic)?$/i.test(str(args.quality).trim());
1223
1204
  let base;
1224
1205
  let identity = false;
1225
- if (wantIdentity || wantPhotoreal)
1206
+ if (wantIdentity)
1226
1207
  for (const e of identityEndpoints()) {
1227
1208
  if (await imageHealthy(e)) {
1228
1209
  base = e;
@@ -1230,7 +1211,6 @@ async function imageGenerate(args) {
1230
1211
  break;
1231
1212
  }
1232
1213
  }
1233
- const photorealFellBack = wantPhotoreal && !identity;
1234
1214
  if (!base)
1235
1215
  for (const e of imageEndpoints()) {
1236
1216
  if (await imageHealthy(e)) {
@@ -1239,12 +1219,9 @@ async function imageGenerate(args) {
1239
1219
  }
1240
1220
  }
1241
1221
  if (!base)
1242
- return `error: no image service reachable — the ${outage("image", "image_generate")} (owner: bring up the flux-worker, image.axe.onl / :8791${wantIdentity || wantPhotoreal ? ", or the identity-worker, identity.axe.onl / :8793" : ""}.)`;
1243
- // SDXL (RealVisXL) is native 1024 and a 512 render of it looks bad; flux-schnell and a face-reference render keep the 512 default.
1244
- const sizeArg = str(args.size);
1245
- const size = /^\d+x\d+$/.test(sizeArg) ? sizeArg : (identity && wantPhotoreal && !wantIdentity ? "1024x1024" : "512x512");
1222
+ 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.`;
1246
1223
  const ctrl = new AbortController();
1247
- const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? (identity ? 300_000 : 180_000))); // a cold FLUX load + denoise is ~tens of seconds; a cold SDXL+identity load alone is ~80-90s
1224
+ const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? 180_000)); // a cold FLUX load + denoise is ~tens of seconds
1248
1225
  try {
1249
1226
  const genBody = { prompt, n, size, ...(wantExpand ? { expand: true } : {}), ...(Number(args.steps) > 0 ? { steps: Number(args.steps) } : {}) };
1250
1227
  if (!identity)
@@ -1263,7 +1240,7 @@ async function imageGenerate(args) {
1263
1240
  body: JSON.stringify(genBody),
1264
1241
  });
1265
1242
  if (!res.ok)
1266
- return `error: image worker returned ${res.status} — the ${outage("image", "image_generate")} (owner: ensure com.axe.flux-worker${identity ? " / the identity-worker" : ""} is up.)`;
1243
+ return `error: image worker returned ${res.status} — ensure the flux-worker broker (com.axe.flux-worker) is up`;
1267
1244
  const j = (await res.json().catch(() => ({})));
1268
1245
  const imgs = j.data ?? [];
1269
1246
  if (!imgs.length)
@@ -1274,8 +1251,7 @@ async function imageGenerate(args) {
1274
1251
  const exp = j.axe_prompt_expansion?.used ? j.axe_prompt_expansion.expanded : undefined; // the broker-rewritten prompt that was actually rendered
1275
1252
  const id = j.axe_identity?.identity_applied ? j.axe_identity : undefined; // the identity broker injected a real face (honest method/fidelity)
1276
1253
  const i2i = !id && j.axe_img2img?.used ? j.axe_img2img : undefined; // pose/style restyle from a reference — NOT the exact face
1277
- const idModel = j.axe_identity?.base_model || "RealVisXL"; // the identity broker reports its base model even when no face was applied
1278
- await recordMediaGen({ tool: "image_generate", prompt, model: id?.base_model || (identity ? idModel : "flux-schnell"), params: { size, n, ...(wantPhotoreal ? { quality: "photoreal" } : {}) }, refs, ok: true, ...(exp ? { expanded: exp } : {}), ...(id ? { identity: id } : {}), ...(i2i ? { img2img: i2i } : {}) });
1254
+ 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 } : {}) });
1279
1255
  const extra = saved.length && refs.some((r) => /^https?:\/\//.test(r)) ? ` (also saved: ${saved.join(", ")})` : "";
1280
1256
  const expNote = exp ? ` (expanded → "${exp.length > 160 ? exp.slice(0, 160) + "…" : exp}")` : "";
1281
1257
  // Honest provenance in the result: name WHICH reference mechanism actually ran, so likeness is never overclaimed.
@@ -1283,16 +1259,12 @@ async function imageGenerate(args) {
1283
1259
  ? ` (identity: ${id.method ?? "reference"}${id.base_model ? ` on ${id.base_model}` : ""}${id.fidelity_note ? ` — ${id.fidelity_note}` : ""})`
1284
1260
  : i2i
1285
1261
  ? ` (img2img restyle @ strength ${i2i.strength ?? "?"} — matches pose/composition/style, NOT the exact face)`
1286
- : identity && !wantIdentity
1287
- ? ` (photoreal: ${idModel} via the identity broker, text-only — no face reference)`
1288
- : photorealFellBack
1289
- ? ` (photoreal worker unreachable — rendered with fast flux-schnell instead; retry later for RealVisXL, and say so if the owner needs the photoreal look)`
1290
- : "";
1262
+ : "";
1291
1263
  return `generated ${refs.length} image${refs.length > 1 ? "s" : ""} (${size}) → ${refs.join(", ")}${extra}${expNote}${refNote}`;
1292
1264
  }
1293
1265
  catch (e) {
1294
1266
  const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1295
- return `error: image worker unreachable at ${base} (${msg}) — the ${outage("image", "image_generate")} (owner: start com.axe.flux-worker on the image node.)`;
1267
+ 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.`;
1296
1268
  }
1297
1269
  finally {
1298
1270
  clearTimeout(timer);
@@ -1335,7 +1307,7 @@ async function videoGenerate(args) {
1335
1307
  }
1336
1308
  }
1337
1309
  if (!base)
1338
- return `error: no video service reachable (tried ${candidates.join(", ")}) — the ${outage("video", "video_generate")} (owner: bring up the video worker, video.axe.onl / :8792.)`;
1310
+ 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.`;
1339
1311
  const ctrl = new AbortController();
1340
1312
  const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? 600_000)); // a cold video model load + sampling runs minutes, not seconds
1341
1313
  try {
@@ -1345,7 +1317,7 @@ async function videoGenerate(args) {
1345
1317
  body: JSON.stringify({ prompt, size, num_frames: numFrames, fps, ...(seed != null ? { seed } : {}), ...(model ? { model } : {}), ...(refImage ? { image: refImage } : {}), ...(wantExpand ? { expand: true } : {}) }),
1346
1318
  });
1347
1319
  if (!res.ok)
1348
- return `error: video worker returned ${res.status} — the ${outage("video", "video_generate")} (owner: ensure the video broker serves /v1/video.)`;
1320
+ return `error: video worker returned ${res.status} — ensure the flux-worker broker serves /v1/video (video_gen.py)`;
1349
1321
  const j = (await res.json().catch(() => ({})));
1350
1322
  const vids = j.data ?? [];
1351
1323
  if (!vids.length)
@@ -1362,7 +1334,7 @@ async function videoGenerate(args) {
1362
1334
  }
1363
1335
  catch (e) {
1364
1336
  const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1365
- return `error: video worker unreachable at ${base} (${msg}) — the ${outage("video", "video_generate")} (owner: start the video broker.)`;
1337
+ 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.`;
1366
1338
  }
1367
1339
  finally {
1368
1340
  clearTimeout(timer);
@@ -1633,7 +1605,7 @@ async function imageAnalyze(args) {
1633
1605
  return await visionComplete(parts, args, 120_000);
1634
1606
  }
1635
1607
  catch (e) {
1636
- return `error: vision — ${String(e?.message ?? e)}. The ${outage("vision", "image_analyze")} (it may only be busy or cold-loading; the owner can also configure a fallback vision endpoint.)`;
1608
+ return `error: vision — ${String(e?.message ?? e)}. The vision model is busy or unavailable; retry shortly, or configure a fallback vision endpoint.`;
1637
1609
  }
1638
1610
  }
1639
1611
  // video_analyze — real video understanding: ffmpeg samples frames evenly across the clip, then the VL model
@@ -1690,7 +1662,7 @@ async function videoAnalyze(args) {
1690
1662
  }
1691
1663
  catch (e) {
1692
1664
  const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1693
- return `error: video_analyze failed (${msg}) — needs ffmpeg on PATH + the Qwen2-VL worker. If the worker is the problem: the ${outage("vision", "video_analyze")}`;
1665
+ return `error: video_analyze failed (${msg}) — needs ffmpeg on PATH + the Qwen2-VL worker`;
1694
1666
  }
1695
1667
  finally {
1696
1668
  await rm(dir, { recursive: true, force: true }).catch(() => { });
@@ -1791,7 +1763,7 @@ async function voiceSpeak(args) {
1791
1763
  }
1792
1764
  }
1793
1765
  if (!base)
1794
- return `error: no voice service reachable (tried ${candidates.join(", ")}) — the ${outage("voice", "voice_speak")} (owner: bring up operator-voice, :8099 / com.axe.operator-voice.)`;
1766
+ return `error: no voice service reachable (tried ${candidates.join(", ")}). Bring up operator-voice (:8099 / com.axe.operator-voice).`;
1795
1767
  const ctrl = new AbortController();
1796
1768
  const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? 60_000));
1797
1769
  try {
@@ -1801,7 +1773,7 @@ async function voiceSpeak(args) {
1801
1773
  body: JSON.stringify({ text, voice }),
1802
1774
  });
1803
1775
  if (!res.ok)
1804
- return `error: voice worker returned ${res.status} on /synthesize — the ${outage("voice", "voice_speak")} (owner: ensure operator-voice is up.)`;
1776
+ return `error: voice worker returned ${res.status} on /synthesize — ensure operator-voice is up`;
1805
1777
  const buf = Buffer.from(await res.arrayBuffer());
1806
1778
  if (!buf.length)
1807
1779
  return "error: voice worker returned no audio";
@@ -1824,7 +1796,7 @@ async function voiceSpeak(args) {
1824
1796
  }
1825
1797
  catch (e) {
1826
1798
  const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1827
- return `error: voice worker unreachable at ${base} (${msg}) — the ${outage("voice", "voice_speak")} (owner: start com.axe.operator-voice on :8099.)`;
1799
+ return `error: voice worker unreachable at ${base} (${msg}) — start operator-voice (com.axe.operator-voice on :8099)`;
1828
1800
  }
1829
1801
  finally {
1830
1802
  clearTimeout(timer);
@@ -1847,7 +1819,7 @@ async function voiceTranscribe(args) {
1847
1819
  }
1848
1820
  }
1849
1821
  if (!base)
1850
- return `error: no voice service reachable (tried ${candidates.join(", ")}) — the ${outage("voice", "voice_transcribe")} (owner: bring up operator-voice, :8099.)`;
1822
+ return `error: no voice service reachable (tried ${candidates.join(", ")}). Bring up operator-voice (:8099).`;
1851
1823
  const ctrl = new AbortController();
1852
1824
  const timer = setTimeout(() => ctrl.abort(), Number(args.timeout_ms ?? 120_000));
1853
1825
  try {
@@ -1860,7 +1832,7 @@ async function voiceTranscribe(args) {
1860
1832
  body: form,
1861
1833
  });
1862
1834
  if (!res.ok)
1863
- return `error: voice worker returned ${res.status} on /transcribe — the ${outage("voice", "voice_transcribe")}`;
1835
+ return `error: voice worker returned ${res.status} on /transcribe`;
1864
1836
  const j = (await res.json().catch(() => ({})));
1865
1837
  if (j.error)
1866
1838
  return `error: transcription failed — ${j.error}`;
@@ -1868,7 +1840,7 @@ async function voiceTranscribe(args) {
1868
1840
  }
1869
1841
  catch (e) {
1870
1842
  const msg = e?.name === "AbortError" ? "timed out" : String(e?.message ?? e);
1871
- return `error: voice worker unreachable at ${base} (${msg}) — the ${outage("voice", "voice_transcribe")} (owner: start operator-voice.)`;
1843
+ return `error: voice worker unreachable at ${base} (${msg}) — start operator-voice`;
1872
1844
  }
1873
1845
  finally {
1874
1846
  clearTimeout(timer);
@@ -2119,7 +2091,7 @@ const TOOLS = [
2119
2091
  run: webSearch,
2120
2092
  },
2121
2093
  {
2122
- name: "deep_research", safe: true, capability: "research",
2094
+ name: "deep_research", safe: true,
2123
2095
  description: "Deep, multi-source web research on a question → a cited brief. Haiku 4.5 plans several search angles, Operator fans out web_search + web_fetch across them, then Haiku synthesizes a thorough answer with inline source citations. Read-only. Use when one search isn't enough — comparisons, state-of-the-art surveys, sourced background. Requires a research API key to be configured.",
2124
2096
  parameters: { type: "object", properties: {
2125
2097
  question: { type: "string", description: "the research question" },
@@ -2141,11 +2113,10 @@ const TOOLS = [
2141
2113
  run: emailSend,
2142
2114
  },
2143
2115
  {
2144
- name: "image_generate", capability: "image",
2145
- description: "Generate an image from a text prompt via the AXE image workers (FLUX.1-schnell fast default; quality \"photoreal\" or a face `reference` → RealVisXL via the identity broker). Returns the image URL or saved path. This is the ONLY way to make images: NEVER install ComfyUI/diffusers/CLIs or load/download diffusion weights — if it errors, retry once, then tell the owner.",
2116
+ name: "image_generate",
2117
+ description: "Generate an image from a text prompt via the AXE image worker (local FLUX.1-schnell, scale-to-zero — no cloud key, no resident GPU). Writes a PNG and returns its path. This is the ONLY way to make images: NEVER load a diffusion model inline (e.g. ml.load of FLUX weights) — that pins GBs on the serving box and crawls your own decode.",
2146
2118
  parameters: { type: "object", properties: {
2147
2119
  prompt: { type: "string", description: "what to generate" },
2148
- quality: { type: "string", enum: ["fast", "photoreal"], description: '"photoreal" → RealVisXL (SDXL) text-to-image via the identity broker (slower, ~1024px, true photoreal; no face needed). Default "fast" = FLUX-schnell. Reach for this INSTEAD of building a photoreal stack.' },
2149
2120
  size: { type: "string", description: 'WxH, e.g. "512x512" (default) or "1024x1024"' },
2150
2121
  n: { type: "number", description: "how many images (1-4, default 1)" },
2151
2122
  reference: { type: "string", description: "optional reference image (path/url). A FACE photo → routes to the identity broker and preserves THAT specific person (IP-Adapter-FaceID) — this is how you 'generate HER'. Otherwise → flux img2img (restyle / match composition)." },
@@ -2159,8 +2130,8 @@ const TOOLS = [
2159
2130
  run: imageGenerate,
2160
2131
  },
2161
2132
  {
2162
- name: "video_generate", capability: "video",
2163
- description: "Generate a short video from a text prompt via the AXE video worker (LTX-Video, video.axe.onl). Returns the video's URL (renderable in-app) or a saved .mp4 path. This is the ONLY way to make video: NEVER install video/diffusion tooling or load/download video-model weights — if it errors, retry once, then tell the owner.",
2133
+ name: "video_generate",
2134
+ description: "Generate a short video from a text prompt via the AXE video worker (LTX-Video on the scale-to-zero broker at video.axe.onl — no cloud key, no resident GPU). Returns the video's URL (renderable in-app) or a saved .mp4 path. NEVER load a video model inline (e.g. ml.load of weights) — that pins GBs on the serving box and crawls your own decode.",
2164
2135
  parameters: { type: "object", properties: {
2165
2136
  prompt: { type: "string", description: "what to generate" },
2166
2137
  size: { type: "string", description: 'WxH, e.g. "704x480" (default; the broker rounds w/h to multiples of 32)' },
@@ -2175,7 +2146,7 @@ const TOOLS = [
2175
2146
  run: videoGenerate,
2176
2147
  },
2177
2148
  {
2178
- name: "image_analyze", safe: true, capability: "vision",
2149
+ name: "image_analyze", safe: true,
2179
2150
  description: "Analyze/describe an image via the AXE vision model (Qwen2-VL on the fleet — REAL vision, not pixel stats). Pass a local path or an http(s) url + an optional question; returns the model's answer. Use this to actually SEE a reference, screenshot, or generated image before acting on it — NEVER guess an image's content from its file size or numpy brightness. ALSO accepts a DOCUMENT (PDF, slide deck/PPTX, DOCX, HTML page, spreadsheet) — its first page is rendered to an image so you can visually analyze a deck, report, or page the same way; for a multi-page document only the opening page is seen.",
2180
2151
  parameters: { type: "object", properties: {
2181
2152
  image: { type: "string", description: "a local file path or an http(s) url — an image, OR a document (pdf/pptx/docx/html/xlsx/…) whose first page is auto-rendered for analysis" },
@@ -2186,7 +2157,7 @@ const TOOLS = [
2186
2157
  run: imageAnalyze,
2187
2158
  },
2188
2159
  {
2189
- name: "image_inspect", safe: true, capability: "vision",
2160
+ name: "image_inspect", safe: true,
2190
2161
  description: "Deterministic FACTS about an image — dimensions, format, megapixels, aspect ratio, file size, dominant colors (hex), frames, and EXIF (camera/lens/date/exposure) — computed classically (Pillow, CPU, instant, no model loaded). Use this instead of image_analyze whenever you need measurements/metadata rather than meaning: it never competes with the serving model for RAM. Reserve image_analyze (the vision model) for SEMANTICS — what is in the image / who is this.",
2191
2162
  parameters: { type: "object", properties: {
2192
2163
  image: { type: "string", description: "a local file path or an http(s) url to the image" },
@@ -2194,7 +2165,7 @@ const TOOLS = [
2194
2165
  run: imageInspect,
2195
2166
  },
2196
2167
  {
2197
- name: "video_analyze", safe: true, capability: "vision",
2168
+ name: "video_analyze", safe: true,
2198
2169
  description: "Analyze/describe a VIDEO via the AXE vision model — ffmpeg samples frames evenly across the clip and Qwen2-VL (multi-image) describes what happens. Pass a local path or an http(s) url + an optional question; returns the analysis. Use this to actually SEE a video's content — never guess from the file.",
2199
2170
  parameters: { type: "object", properties: {
2200
2171
  video: { type: "string", description: "a local file path or an http(s) url to the video" },
@@ -2206,7 +2177,7 @@ const TOOLS = [
2206
2177
  run: videoAnalyze,
2207
2178
  },
2208
2179
  {
2209
- name: "voice_speak", safe: false, capability: "voice",
2180
+ name: "voice_speak", safe: false,
2210
2181
  description: "Speak text aloud in Operator's OWN voice (Kokoro TTS on operator-voice :8099). Synthesizes `text` to speech in `voice` (default bf_emma, the canonical Operator/Cortana voice) and plays it on the owner's machine. Use it to actually SAY something to the owner — a spoken status, answer, or heads-up — not just print it. Saves the WAV and returns its path; on a headless/remote box it saves without playing (pass play:false to only synthesize for a surface to play).",
2211
2182
  parameters: { type: "object", properties: {
2212
2183
  text: { type: "string", description: "what to say" },
@@ -2218,7 +2189,7 @@ const TOOLS = [
2218
2189
  run: voiceSpeak,
2219
2190
  },
2220
2191
  {
2221
- name: "voice_transcribe", safe: true, capability: "voice",
2192
+ name: "voice_transcribe", safe: true,
2222
2193
  description: "Transcribe an audio file to text via Operator's speech-to-text (whisper.cpp on operator-voice :8099). Pass a local `file` (wav/mp3/m4a/ogg — any ffmpeg-readable format); returns the transcribed text. Use this to actually HEAR a voice note or recording the owner shares, instead of guessing at it.",
2223
2194
  parameters: { type: "object", properties: {
2224
2195
  file: { type: "string", description: "local path to an audio file (wav/mp3/m4a/ogg)" },
@@ -2227,7 +2198,7 @@ const TOOLS = [
2227
2198
  run: voiceTranscribe,
2228
2199
  },
2229
2200
  {
2230
- name: "image_recreate", capability: "image",
2201
+ name: "image_recreate",
2231
2202
  description: "Recreate a shared REFERENCE image: Operator SEES it with the vision model, extracts a faithful text-to-image prompt, and generates a matching image — the 'share a reference → recreate it' flow in one call. Pass a local path or http(s) url + optional `instructions` to adjust. Returns the recreation + what it understood. (Pixel-exact fidelity — same face/scene — will use img2img/IP-Adapter once the edit broker lands; today it matches subject/style/composition/lighting from the analyzed prompt.)",
2232
2203
  parameters: { type: "object", properties: {
2233
2204
  reference: { type: "string", description: "the reference image to recreate (a local path or an http(s) url)" },
@@ -2248,7 +2219,7 @@ const TOOLS = [
2248
2219
  run: artifactCreate,
2249
2220
  },
2250
2221
  {
2251
- name: "skill_list", safe: true, capability: "skills",
2222
+ name: "skill_list", safe: true,
2252
2223
  description: "List or search AXE skills from the Operator registry (operator.axe.onl /v1/skills) — reusable playbooks for code review, security audit, debugging, architecture, and more. With no query it lists the curated skills; pass a query to search the full catalogue (community skills too). Read-only.",
2253
2224
  parameters: { type: "object", properties: {
2254
2225
  query: { type: "string", description: "optional search term — also searches community skills; omit for the curated list" },
@@ -2256,7 +2227,7 @@ const TOOLS = [
2256
2227
  run: (a) => skillList(str(a.query)),
2257
2228
  },
2258
2229
  {
2259
- name: "skill_fetch", safe: true, capability: "skills",
2230
+ name: "skill_fetch", safe: true,
2260
2231
  description: "Fetch one AXE skill by name from the hub (or your profile) and return its full instructions to follow/apply. Checks your saved profile skills first, then the hub (operator.axe.onl/skills.axe.onl). For directory skills, pass file_path to load a linked file (references/, templates/, scripts/). Read-only.",
2261
2232
  parameters: { type: "object", properties: {
2262
2233
  slug: { type: "string", description: "the skill name/slug to fetch and use" },
@@ -2265,7 +2236,7 @@ const TOOLS = [
2265
2236
  run: (a) => skillFetch(str(a.slug), str(a.file_path).trim() || undefined),
2266
2237
  },
2267
2238
  {
2268
- name: "skill_save", capability: "skills",
2239
+ name: "skill_save",
2269
2240
  description: "Save a reusable skill to your profile so it persists and is available next session with no settings edit — auto-harvest a new capability. Saved skills are listed by skill_list and loaded by skill_fetch (profile skills take precedence over the hub). Use when you've worked out a repeatable playbook worth keeping.",
2270
2241
  parameters: { type: "object", properties: {
2271
2242
  name: { type: "string", description: "short skill name (kebab-cased automatically)" },
@@ -2329,7 +2300,7 @@ const TOOLS = [
2329
2300
  run: runCronTool,
2330
2301
  },
2331
2302
  {
2332
- name: "delegate_task", safe: false, capability: "subtask",
2303
+ name: "delegate_task", safe: false,
2333
2304
  description: "Hand ONE self-contained subtask to a sub-agent running on a chosen fleet model and get its final answer back (blocks until it finishes). The sub-agent is a full headless Operator session with its own tools, but NO memory of this conversation and it cannot ask you questions — so `task` must carry everything it needs (paths, constraints, the exact output you want). `model` is any /model id. CHOOSE IT BY TOOL-LOAD: use \"scout\" (fast 4B) ONLY for self-contained, tool-LIGHT subtasks (a lookup, a summary, a single-file edit); a 4B model drives tools unreliably, so anything TOOL-HEAVY — reviewing a remote/GitHub repo, multi-file exploration, web research, debugging, a repo audit — MUST go to \"cortana\" (the flagship) or it will spin without real progress. Also available: venice-24b, qwen3.8-flash, operator-1m. Use it to farm out an independent chunk while you keep planning; do not delegate what you can do in one tool call. Sub-agents cannot delegate further. The sub-agent runs with the owner's permission policy and can mutate the workspace.",
2334
2305
  parameters: { type: "object", properties: {
2335
2306
  task: { type: "string", description: "the complete, self-contained subtask — the sub-agent sees only this" },
@@ -2378,7 +2349,7 @@ const TOOLS = [
2378
2349
  },
2379
2350
  },
2380
2351
  {
2381
- name: "skill_catalog", safe: false, capability: "skills",
2352
+ name: "skill_catalog", safe: false,
2382
2353
  description: "The gated OFFICIAL optional-skills catalogue that ships with Operator (152 entries across 23 categories, MIT from the hermes-agent project). Nothing from it is active unless installed. actions: browse(query?) lists entries + categories (read-only), install(name) copies a skill tree into the operator home's skills/ so it is live for skill_list/skill_fetch next session, remove(name) deletes an installed catalogue copy (hand-written skills are never touched).",
2383
2354
  parameters: { type: "object", properties: {
2384
2355
  action: { type: "string", enum: ["browse", "install", "remove"], description: "what to do" },
@@ -2387,9 +2358,6 @@ const TOOLS = [
2387
2358
  }, required: ["action"] },
2388
2359
  run: runSkillCatalog,
2389
2360
  },
2390
- // AXE power-tools (tools/power-tools.ts) — always in the registry (so the Map, the safe-tool allowlist and the
2391
- // catalogue/parity tests stay complete), but a disabled group is filtered out per-session by visibleRegistry().
2392
- ...POWER_TOOLS,
2393
2361
  ];
2394
2362
  // AXE skill registry (parity with the Python core): a REMOTE HTTPS registry reachable from every surface
2395
2363
  // (CLI/web/mobile), so skills work everywhere without local fleet access. Bearer from OPERATOR_TOKEN or
@@ -2550,20 +2518,6 @@ export async function localSkills() {
2550
2518
  return listLocalSkills();
2551
2519
  }
2552
2520
  export const registry = new Map(TOOLS.map(t => [t.name, t]));
2553
- /** The registry a session/surface should actually expose: the full `registry` minus the power-tools whose
2554
- * feature-flag group is OFF. Passed to BOTH the session's schemas/executor (session.ts) and the system-prompt
2555
- * catalogue (composeSystemPrompt → renderToolCatalogue) so what the model is told it HAS and what it can CALL
2556
- * stay identical. `undefined` cfg ⇒ the DEFAULT config (fleet groups off) — fail-closed. */
2557
- export function visibleRegistry(cfg) {
2558
- const off = disabledPowerToolNames(cfg);
2559
- if (off.size === 0)
2560
- return registry;
2561
- const out = new Map();
2562
- for (const [name, tool] of registry)
2563
- if (!off.has(name))
2564
- out.set(name, tool);
2565
- return out;
2566
- }
2567
2521
  export function toSchemas(reg = registry) {
2568
2522
  return [...reg.values()].map(t => ({
2569
2523
  type: "function",
@@ -2572,32 +2526,6 @@ export function toSchemas(reg = registry) {
2572
2526
  }
2573
2527
  const CATALOGUE_LIST_CAP = 24000;
2574
2528
  const MCP_NOTE_MAX = 12;
2575
- const CATALOGUE_LINE_MAX = 280; // a line that must carry a prohibition may grow to this (vs 150 for the rest)
2576
- // A description sentence that carries a PROHIBITION ("This is the ONLY way to make images: NEVER install …").
2577
- // A catalogue line trimmed at 150 chars used to cut exactly this clause off the system prompt — the model saw the
2578
- // tool but not the rule, and (live 10-09) built its own ComfyUI stack instead. Case-sensitive on purpose: these are
2579
- // the shouted markers the descriptions use, not the ordinary word "never".
2580
- const PROHIBITION_RE = /\b(?:NEVER|Do NOT|do NOT|DON'T|ONLY (?:correct )?way)\b|\b[Dd]o not install\b/;
2581
- // Fixed order of the capability map; the names come from the live registry's `capability` tags, so a newly tagged
2582
- // tool lands in the map with no prose to drift.
2583
- const CAPABILITY_ORDER = ["image", "video", "vision", "voice", "research", "subtask", "skills"];
2584
- /** The capability MAP for the system prompt: capability → the native tool(s) that provide it, plus the
2585
- * failure-semantics rule. Emitted by renderToolCatalogue in BOTH the full and the `lean` form (it is the one
2586
- * part of the catalogue a small-context model must still see): "a row exists → the tool exists; errors are an
2587
- * outage → retry/report; never install to replicate". "" when the map has no tagged tools (e.g. a bare test map). */
2588
- export function renderCapabilityMap(reg = registry) {
2589
- const rows = [];
2590
- for (const cap of CAPABILITY_ORDER) {
2591
- const names = [...reg.values()].filter((t) => t.capability === cap).map((t) => `\`${t.name}\``);
2592
- if (names.length)
2593
- rows.push(`${cap} → ${names.join(", ")}`);
2594
- }
2595
- if (!rows.length)
2596
- return "";
2597
- return (`\n**Capability map** (a row exists → that tool EXISTS: use it, never rebuild it): ${rows.join(" · ")}. ` +
2598
- `A tool error is an OUTAGE of a shared service — retry once, then tell the owner. NEVER install tooling ` +
2599
- `(ComfyUI, diffusers, whisper, CLIs) or download model weights to replicate a capability that has a row above.`);
2600
- }
2601
2529
  // Best-effort SYNCHRONOUS read of the owned-MCP registry (the name-keyed map loadMcpConfig consumes, from
2602
2530
  // $KODE_MCP_CONFIG or ~/.axe/cli/backend/mcp_servers.json) so the catalogue names the servers actually
2603
2531
  // configured, not a hard-coded example. process.getBuiltinModule (Node ≥20.16) keeps this module free of a
@@ -2639,27 +2567,13 @@ function ownedMcpNote() {
2639
2567
  // small-context model) skips the per-tool list — it duplicates the schemas attached to every request — and
2640
2568
  // keeps only the surface summary; the list is also char-capped so a large merged map can't blow the prompt.
2641
2569
  export function renderToolCatalogue(reg = registry, opts = {}) {
2642
- const wordCut = (t, n) => {
2643
- const cut = t.slice(0, n);
2644
- const sp = cut.lastIndexOf(" ");
2645
- return (sp > 60 ? cut.slice(0, sp) : cut) + "…";
2646
- };
2647
2570
  const short = (d) => {
2648
2571
  const one = d.replace(/\s+/g, " ").trim();
2649
2572
  if (one.length <= 150)
2650
2573
  return one;
2651
- const m = PROHIBITION_RE.exec(one);
2652
- if (!m)
2653
- return wordCut(one, 150);
2654
- // Never truncate a prohibition away: keep through the end of the sentence that carries it; if that is too long
2655
- // to stay contiguous with the head, a short head + the prohibition sentence itself.
2656
- const dot = one.indexOf(". ", m.index);
2657
- const end = dot < 0 ? one.length : dot + 1;
2658
- if (end <= CATALOGUE_LINE_MAX)
2659
- return one.slice(0, end);
2660
- const prev = one.lastIndexOf(". ", m.index);
2661
- const clause = one.slice(prev < 0 ? 0 : prev + 2, end);
2662
- return `${wordCut(one, 100)} ${clause.length > CATALOGUE_LINE_MAX ? one.slice(m.index, end) : clause}`;
2574
+ const cut = one.slice(0, 150);
2575
+ const sp = cut.lastIndexOf(" ");
2576
+ return (sp > 60 ? cut.slice(0, sp) : cut) + "…";
2663
2577
  };
2664
2578
  let head;
2665
2579
  if (opts.lean) {
@@ -2683,7 +2597,6 @@ export function renderToolCatalogue(reg = registry, opts = {}) {
2683
2597
  }
2684
2598
  return (`\n\n## Your capabilities — the full surface (use a tool you HAVE; don't claim one you don't)\n` +
2685
2599
  head +
2686
- renderCapabilityMap(reg) +
2687
2600
  `\n\n**MCP tools** — with the MCP layer on (the owner types \`/mcp on\`) more tools load from configured servers and ` +
2688
2601
  `appear alongside the native ones.` +
2689
2602
  ownedMcpNote() +