@0perator/operator 0.2.0 → 0.2.2-next.0
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/README.md +5 -4
- package/dist/auth/byo.js +1 -1
- package/dist/auth/commands.js +15 -5
- package/dist/auth/identity.js +1 -0
- package/dist/auth/staff.js +55 -0
- package/dist/autonomy/agent-cli.js +1 -1
- package/dist/autonomy/delegate-mode.js +2 -2
- package/dist/autonomy/delegate.js +41 -14
- package/dist/autonomy/headless.js +37 -10
- package/dist/autonomy/index.js +2 -4
- package/dist/autonomy/pr-isolation.js +92 -0
- package/dist/autonomy/pr-preflight.js +474 -0
- package/dist/autonomy/session-factory.js +13 -12
- package/dist/autonomy/subagent-model.js +17 -7
- package/dist/background/capacity.js +136 -0
- package/dist/background/evidence.js +42 -0
- package/dist/background/index.js +311 -44
- package/dist/background/lane-phase.js +60 -0
- package/dist/background/lane-summary.js +151 -0
- package/dist/background/notices.js +12 -3
- package/dist/background/synthesis.js +25 -0
- package/dist/browser/capture.js +505 -0
- package/dist/browser/engine.js +4 -3
- package/dist/browser/page-capture.js +167 -0
- package/dist/browser/png.js +116 -0
- package/dist/browser/visual-compare.js +229 -0
- package/dist/bus/beam-drop.js +55 -0
- package/dist/bus/inbox.js +157 -7
- package/dist/cli.js +316 -120
- package/dist/config/features.js +3 -3
- package/dist/config/managed.js +40 -1
- package/dist/config/persona.js +80 -29
- package/dist/config/product-hosts.js +2 -0
- package/dist/config/settings.js +289 -31
- package/dist/config/skills-index.js +37 -14
- package/dist/config/staff-prompt.js +12 -0
- package/dist/engine/agent.js +52 -41
- package/dist/engine/aurora.js +54 -13
- package/dist/engine/batch-scheduler.js +4 -13
- package/dist/engine/compaction.js +1 -1
- package/dist/engine/continuation.js +66 -32
- package/dist/engine/decision-points.js +2 -3
- package/dist/engine/fanout.js +16 -0
- package/dist/engine/identity.js +42 -0
- package/dist/engine/loop-guard.js +26 -83
- package/dist/engine/messages.js +2 -2
- package/dist/engine/moa.js +23 -1
- package/dist/engine/native-vision-node.js +72 -0
- package/dist/engine/native-vision.js +103 -0
- package/dist/engine/net-error.js +15 -0
- package/dist/engine/rolling-summary.js +142 -93
- package/dist/engine/verify-gate.js +37 -7
- package/dist/engine/waterfall.js +33 -0
- package/dist/gateway-cli.js +24 -4
- package/dist/memory/live-progress.js +4 -5
- package/dist/memory/session-index.js +3 -3
- package/dist/moa/codeact-lane.js +98 -0
- package/dist/moa/codeact-sandbox.js +409 -0
- package/dist/moa/codeact.js +140 -0
- package/dist/permissions/artifact-visibility.js +10 -0
- package/dist/permissions/index.js +2 -1
- package/dist/permissions/policy.js +9 -2
- package/dist/permissions/tier.js +13 -3
- package/dist/products/craft.js +92 -3
- package/dist/products/temple.js +20 -1
- package/dist/products/voice.js +112 -0
- package/dist/remote/grants.js +119 -0
- package/dist/remote/host.js +33 -5
- package/dist/router/free-models.js +5 -9
- package/dist/router/models.js +80 -26
- package/dist/router/provider-models.js +78 -0
- package/dist/router/router.js +15 -3
- package/dist/selfimprove/index.js +8 -6
- package/dist/selfimprove/lessons.js +23 -0
- package/dist/services/preflight.js +35 -91
- package/dist/session.js +316 -125
- package/dist/skills/catalogue.js +5 -2
- package/dist/skills/finder.js +4 -4
- package/dist/skills/install-guard.js +68 -0
- package/dist/skills/install.js +67 -0
- package/dist/toolchain/manifest.json +13 -13
- package/dist/tools/background-result.js +1 -1
- package/dist/tools/beam.js +246 -0
- package/dist/tools/classes.js +103 -0
- package/dist/tools/contract.js +1 -1
- package/dist/tools/craft.js +36 -2
- package/dist/tools/deferred.js +7 -3
- package/dist/tools/doc-text.js +1 -1
- package/dist/tools/executor.js +25 -15
- package/dist/tools/generation-gateway.js +94 -0
- package/dist/tools/registry.js +135 -158
- package/dist/tools/sandbox.js +6 -6
- package/dist/ui/App.js +17 -6
- package/dist/ui/ApprovalPrompt.js +1 -1
- package/dist/ui/BgPanel.js +15 -10
- package/dist/ui/Composer.js +44 -2
- package/dist/ui/Header.js +1 -6
- package/dist/ui/StatusRule.js +20 -8
- package/dist/ui/ToolStep.js +3 -3
- package/dist/ui/Transcript.js +41 -14
- package/dist/ui/batchLine.js +4 -4
- package/dist/ui/editdiff.js +2 -4
- package/dist/ui/format.js +4 -20
- package/dist/ui/liveTools.js +3 -3
- package/dist/ui/modelPicker.js +10 -6
- package/dist/ui/opsMode.js +20 -0
- package/dist/ui/phase.js +4 -2
- package/dist/ui/slashCommands.js +1 -0
- package/dist/ui/types.js +0 -2
- package/dist/ui/voice.js +185 -0
- package/dist/update-check.js +17 -6
- package/dist/update.js +1 -2
- package/dist/util/audio-io.js +82 -0
- package/dist/util/slash.js +2 -2
- package/dist/vision/pairs.js +239 -0
- package/package.json +1 -1
- package/dist/tools/mutating.js +0 -15
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
// (there is no launchd; ensureServices returns everything "down" and the caller reports it).
|
|
6
6
|
//
|
|
7
7
|
// TWO tiers, and the split is the whole point:
|
|
8
|
-
// • Aurora
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// the published endpoint and reports `idle` for a local job that is not serving. Operator only ever brings
|
|
12
|
-
// it UP; it NEVER stops Aurora on exit, because that would break every other client.
|
|
8
|
+
// • Aurora (co.0perator.gateway) is RETIRED (11/25): Operator never starts it — not at boot, not for a turn, not
|
|
9
|
+
// from /services. auroraAtBoot only resolves the published endpoint (server.json) and reports; `operator gateway
|
|
10
|
+
// start` refuses without --force. Operator also never stops it on exit.
|
|
13
11
|
// • autopilot (:9333) is optional and handled the same start-only way (non-fatal if it won't come up).
|
|
14
12
|
// • vision (:7788, axe.vision-bot) is OFF BY DEFAULT — the media-pipeline ADR (2026-10-19) keeps the
|
|
15
13
|
// GPU with Aurora, so boot only PROBES + reports it (settings DEFAULTS ship autostart:false). Nothing
|
|
@@ -118,8 +116,9 @@ async function ensureLaunchd(name, healthUrl, okOnly, cfg, onProgress) {
|
|
|
118
116
|
: { name, state: "down", detail: `started the launchd job but ${name} did not report ready at ${healthUrl} within ${waitSec}s` };
|
|
119
117
|
}
|
|
120
118
|
/** Start `name`'s launchd job: kickstart -k when it is loaded, else bootout any half-state and bootstrap the plist
|
|
121
|
-
* fresh. Returns the report when it will not start it (autostart off, no label/uid, plist missing), else null.
|
|
122
|
-
|
|
119
|
+
* fresh. Returns the report when it will not start it (autostart off, no label/uid, plist missing), else null.
|
|
120
|
+
* Optional companions only (autopilot, vision): nothing calls it for Aurora. */
|
|
121
|
+
export async function kickLaunchd(name, cfg, onProgress) {
|
|
123
122
|
if (cfg.autostart === false)
|
|
124
123
|
return { name, state: "down", detail: "down (autostart off)" };
|
|
125
124
|
cfg = await withLegacyLabel(cfg);
|
|
@@ -141,7 +140,10 @@ async function kickLaunchd(name, cfg, onProgress) {
|
|
|
141
140
|
}
|
|
142
141
|
const run = cfg.launchctl ?? launchctl;
|
|
143
142
|
const disabled = await run(["print-disabled", `gui/${uid}`]);
|
|
144
|
-
|
|
143
|
+
// Fail closed: when launchd's disabled list cannot be read, the owner's `launchctl disable` cannot be honored, so nothing starts.
|
|
144
|
+
if (disabled.code !== 0)
|
|
145
|
+
return { name, state: "down", detail: `down (cannot read launchd's disabled list for ${label} — not starting it)` };
|
|
146
|
+
if (isLaunchdDisabled(disabled.out, label))
|
|
145
147
|
return { name, state: "disabled", detail: disabledLine(name, label) };
|
|
146
148
|
onProgress?.(`starting ${name} via launchd…`);
|
|
147
149
|
const target = `gui/${uid}/${label}`;
|
|
@@ -188,90 +190,45 @@ const auroraHealth = (base) => (base ? `${base.replace(/\/$/, "")}/health` : "")
|
|
|
188
190
|
function applyDiscovered(cfg, d) {
|
|
189
191
|
if (!d)
|
|
190
192
|
return;
|
|
191
|
-
|
|
193
|
+
const found = normBase(d.base);
|
|
194
|
+
if (cfg.base && !gatewayBases.has(normBase(cfg.base)) && normBase(cfg.base) !== found)
|
|
195
|
+
return; // an explicit endpoint (the router, a remote) is not the gateway's to overwrite
|
|
196
|
+
gatewayBases.add(found);
|
|
197
|
+
cfg.base = found;
|
|
192
198
|
if (d.apiKey)
|
|
193
199
|
cfg.apiKey = d.apiKey;
|
|
194
200
|
}
|
|
195
|
-
|
|
196
|
-
|
|
201
|
+
const normBase = (b) => b.replace(/\/+$/, "").replace(/\/v1$/, "");
|
|
202
|
+
/** Every base this process has resolved from the gateway's server.json: the endpoints that ARE the local gateway. */
|
|
203
|
+
const gatewayBases = new Set();
|
|
204
|
+
/** True iff the endpoint is the local gateway: unset (auto-discover) or a base resolved from its server.json. Any other
|
|
205
|
+
* base (the router's `main`, a remote or tester endpoint) is served by something else, so a miss there is `down`, not
|
|
206
|
+
* `idle`. Call after applyDiscovered. */
|
|
207
|
+
function servedByLocalGateway(base) {
|
|
208
|
+
return !base || gatewayBases.has(normBase(base));
|
|
209
|
+
}
|
|
210
|
+
/** True iff Aurora is a launchd job on this box (its plist, or a legacy one, is on disk). A remote or tester endpoint has
|
|
211
|
+
* no job here and keeps the old health-gated report. */
|
|
197
212
|
async function localAuroraJob(cfg) {
|
|
198
213
|
const job = await withLegacyLabel(cfg);
|
|
199
214
|
return !!job.launchdLabel && !!job.plistPath && (await fileExists(expandHome(job.plistPath)));
|
|
200
215
|
}
|
|
201
216
|
/** Boot's view of Aurora: resolve the published endpoint and report, never start the gateway. A local job that is not
|
|
202
|
-
* serving is `idle` (
|
|
217
|
+
* serving is `idle` (retired: nothing loads it); with no local job it is `down`, as before. */
|
|
203
218
|
export async function auroraAtBoot(cfg) {
|
|
204
219
|
applyDiscovered(cfg, await discoverAuroraServer());
|
|
205
220
|
const state = cfg.base ? await probe(auroraHealth(cfg.base), true) : "refused";
|
|
206
221
|
if (state === "ready")
|
|
207
222
|
return { name: "aurora", state: "up" };
|
|
208
|
-
if (await localAuroraJob(cfg))
|
|
209
|
-
return { name: "aurora", state: "idle", detail: state === "loading" ? "loading" : "
|
|
223
|
+
if (servedByLocalGateway(cfg.base) && (await localAuroraJob(cfg)))
|
|
224
|
+
return { name: "aurora", state: "idle", detail: state === "loading" ? "loading" : "not serving (retired — Operator does not start it)" };
|
|
210
225
|
return { name: "aurora", state: "down", detail: cfg.base ? `no response from ${cfg.base}` : "no gateway endpoint published" };
|
|
211
226
|
}
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const first = cfg.base ? await probe(auroraHealth(cfg.base), true) : "refused";
|
|
216
|
-
if (first === "ready")
|
|
217
|
-
return { name: "aurora", state: "up" };
|
|
218
|
-
if (first === "loading")
|
|
219
|
-
onProgress?.("aurora is loading…");
|
|
220
|
-
else {
|
|
221
|
-
const refused = await kickLaunchd("aurora", cfg, onProgress);
|
|
222
|
-
if (refused)
|
|
223
|
-
return refused;
|
|
224
|
-
}
|
|
225
|
-
const waitSec = cfg.waitSec ?? 90;
|
|
226
|
-
return (await waitForAurora(cfg, waitSec, signal))
|
|
227
|
-
? { name: "aurora", state: first === "loading" ? "up" : "started" }
|
|
228
|
-
: { name: "aurora", state: "down", detail: `aurora did not report ready within ${waitSec}s` };
|
|
229
|
-
}
|
|
230
|
-
/** Poll until the published endpoint answers /health, re-reading server.json each time: the gateway publishes its
|
|
231
|
-
* base only once llama-server is spawned and deletes server.json when it stops, so a base read before the kick is
|
|
232
|
-
* stale or absent. Polling that one is the 11/03 boot that sat 90 s on "starting aurora via launchd…" with Aurora
|
|
233
|
-
* ready after 16 s. */
|
|
234
|
-
export async function waitForAurora(cfg, waitSec, signal) {
|
|
235
|
-
for (let waited = 0;; waited += 2) {
|
|
236
|
-
applyDiscovered(cfg, await discoverAuroraServer());
|
|
237
|
-
if (cfg.base && (await probe(auroraHealth(cfg.base), true)) === "ready")
|
|
238
|
-
return true;
|
|
239
|
-
if (waited >= waitSec || signal?.aborted)
|
|
240
|
-
return false;
|
|
241
|
-
await new Promise((res) => setTimeout(res, 2000));
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
/** The Session's onDemand hook for a local Aurora: before a turn on the default model, make sure the gateway is
|
|
245
|
-
* serving (start it if not), and when its published base or key changed write them onto `endpoint` and return
|
|
246
|
-
* `rebuild()`. Inert where Aurora is not a local launchd job, so a remote endpoint is never probed per turn. */
|
|
247
|
-
export function auroraOnDemand(endpoint, svc, rebuild, onProgress, onDisabled) {
|
|
248
|
-
let local;
|
|
249
|
-
let told = false;
|
|
250
|
-
return async (signal) => {
|
|
251
|
-
local ??= localAuroraJob(svc ?? {});
|
|
252
|
-
if (!(await local))
|
|
253
|
-
return null;
|
|
254
|
-
const cfg = { ...svc, base: endpoint.base, apiKey: endpoint.apiKey };
|
|
255
|
-
const report = await ensureAurora(cfg, onProgress, signal);
|
|
256
|
-
if (report.state === "disabled") {
|
|
257
|
-
if (!told && report.detail)
|
|
258
|
-
onDisabled?.(report.detail); // once per session: the router's next leg answers every turn
|
|
259
|
-
told = true;
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
if (cfg.base === endpoint.base && cfg.apiKey === endpoint.apiKey)
|
|
263
|
-
return null;
|
|
264
|
-
endpoint.base = cfg.base;
|
|
265
|
-
if (cfg.apiKey)
|
|
266
|
-
endpoint.apiKey = cfg.apiKey;
|
|
267
|
-
return rebuild();
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
/** Ensure the services Operator depends on are up. Aurora first (required, health-gated; with auroraOnDemand only
|
|
271
|
-
* resolved and reported); autopilot and vision are optional and never block. Returns one report per service for the
|
|
272
|
-
* boot UI. Mutates cfg.aurora.base in-place when the dynamic port is discovered from server.json. */
|
|
227
|
+
/** Ensure the services Operator depends on are up. Aurora is only resolved and reported (auroraAtBoot); autopilot and
|
|
228
|
+
* vision are optional and never block. Returns one report per service for the boot UI. Mutates cfg.aurora.base
|
|
229
|
+
* in-place when the dynamic port is discovered from server.json. */
|
|
273
230
|
export async function ensureServices(cfg) {
|
|
274
|
-
const reports = [
|
|
231
|
+
const reports = [await auroraAtBoot(cfg.aurora)];
|
|
275
232
|
if (cfg.autopilot) {
|
|
276
233
|
reports.push(await ensureOptional("autopilot", cfg.autopilot, cfg.onProgress));
|
|
277
234
|
}
|
|
@@ -303,21 +260,8 @@ async function installCompanion(name) {
|
|
|
303
260
|
}
|
|
304
261
|
catch { /* installer unavailable — the boot already skipped cleanly, nothing else to do */ }
|
|
305
262
|
}
|
|
306
|
-
/**
|
|
307
|
-
*
|
|
308
|
-
* Fire-and-forget: never awaited from boot, never throws — a failed warmup just means the old behavior. */
|
|
309
|
-
export async function warmAurora(base, model) {
|
|
310
|
-
try {
|
|
311
|
-
await fetch(`${base.replace(/\/$/, "")}/v1/chat/completions`, {
|
|
312
|
-
method: "POST",
|
|
313
|
-
headers: { "content-type": "application/json" },
|
|
314
|
-
body: JSON.stringify({ model, messages: [{ role: "user", content: "warmup" }], max_tokens: 1, temperature: 0 }),
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
catch { /* best-effort — warmup failing just restores the cold-first-turn behavior */ }
|
|
318
|
-
}
|
|
319
|
-
/** Tear down ONLY the session-scoped services on exit. Aurora and autopilot are shared, always-on, and
|
|
320
|
-
* owned by launchd — Operator never stops them (other clients depend on :8097). SearXNG is the one
|
|
263
|
+
/** Tear down ONLY the session-scoped services on exit. Aurora and autopilot are shared and owned by launchd —
|
|
264
|
+
* Operator never stops them. SearXNG is the one
|
|
321
265
|
* service Operator owns end to end. Best-effort; safe to call more than once. */
|
|
322
266
|
export async function stopSessionServices(opts) {
|
|
323
267
|
if (opts?.searxng === false)
|