@0perator/operator 0.1.31 → 0.1.32

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.31";
21
+ const VERSION = "0.1.32";
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).
@@ -289,12 +289,17 @@ function Root() {
289
289
  // health, so a cold box self-heals instead of dropping the owner at "start it yourself and relaunch".
290
290
  let reports = [];
291
291
  try {
292
- const { ensureServices } = await import("./services/preflight.js");
293
- reports = await ensureServices({
292
+ const preflight = await import("./services/preflight.js");
293
+ reports = await preflight.ensureServices({
294
294
  aurora: { base: settings.endpoints.aurora.base, ...settings.services?.aurora },
295
295
  autopilot: settings.services?.autopilot,
296
296
  onProgress: setBootDetail,
297
297
  });
298
+ // If the lever COLD-STARTED Aurora, prime it (fire-and-forget) so the first real turn doesn't
299
+ // eat the graph/Metal warmup. Skipped when Aurora was already up (state "up").
300
+ if (reports.find((r) => r.name === "aurora")?.state === "started") {
301
+ void preflight.warmAurora(settings.endpoints.aurora.base, settings.endpoints.aurora.model);
302
+ }
298
303
  }
299
304
  catch { /* preflight is best-effort — fall through to the authoritative health check */ }
300
305
  const ok = await session.health().catch(() => false);
@@ -107,6 +107,19 @@ export async function ensureServices(cfg) {
107
107
  }
108
108
  return reports;
109
109
  }
110
+ /** Prime a just-started (cold) Aurora with a 1-token request so the FIRST real turn doesn't pay the
111
+ * graph/Metal-shader warmup (the plist runs --no-warmup, so otherwise the owner's first turn eats it).
112
+ * Fire-and-forget: never awaited from boot, never throws — a failed warmup just means the old behavior. */
113
+ export async function warmAurora(base, model) {
114
+ try {
115
+ await fetch(`${base.replace(/\/$/, "")}/v1/chat/completions`, {
116
+ method: "POST",
117
+ headers: { "content-type": "application/json" },
118
+ body: JSON.stringify({ model, messages: [{ role: "user", content: "warmup" }], max_tokens: 1, temperature: 0 }),
119
+ });
120
+ }
121
+ catch { /* best-effort — warmup failing just restores the cold-first-turn behavior */ }
122
+ }
110
123
  /** Tear down ONLY the session-scoped services on exit. Aurora and autopilot are shared, always-on, and
111
124
  * owned by launchd — Operator never stops them (other clients depend on :8097). SearXNG is the one
112
125
  * service Operator owns end to end. Best-effort; safe to call more than once. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
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": {