@0perator/operator 0.1.332 → 0.1.333
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/auth/byo.js +5 -0
- package/dist/cli.js +1 -1
- package/dist/config/settings.js +6 -3
- package/dist/router/free-models.js +3 -2
- package/dist/router/models.js +4 -0
- package/dist/services/preflight.js +17 -2
- package/dist/ui/modelPicker.js +2 -2
- package/package.json +1 -1
- package/dist/engine/cli.js +0 -1171
- package/dist/router/models.js.bak +0 -78
- package/dist/router/models.js.bak-1791259923 +0 -78
- package/dist/router/models.js.bak-pre-gateway +0 -78
- package/dist/router/models.js.bak-pre-patch2 +0 -78
- package/dist/router/models.js.bak2 +0 -78
- package/dist/services/model-autodetect.js +0 -240
- package/dist/tools/native-redirect.js +0 -140
- package/dist/tools/power-tools.js +0 -627
- package/dist/tools/registry.js.bak-1791259948 +0 -1914
- package/dist/tools/registry.js.bak-pre-plugins +0 -1914
- package/dist/ui/BusTray.js +0 -70
- package/dist/ui/resize.js +0 -160
package/dist/auth/byo.js
CHANGED
|
@@ -14,6 +14,7 @@ import { platform } from "node:os";
|
|
|
14
14
|
import { dirname } from "node:path";
|
|
15
15
|
import { operatorPath } from "../config/home.js";
|
|
16
16
|
import { BYO_PRESETS } from "../router/models.js"; // leaf registry (no imports of its own) — no cycle
|
|
17
|
+
import { getOperatorToken } from "../engine/aurora.js";
|
|
17
18
|
const SERVICE = "axe-operator-byo";
|
|
18
19
|
// Resolved per call, not at import: the file follows $KODE_HOME / $KODE_PROFILE, so a profile's vendor keys
|
|
19
20
|
// never land in (or get read from) another identity's file.
|
|
@@ -72,7 +73,11 @@ export function getByoToken(account, endpoint) {
|
|
|
72
73
|
export function hasStoredByoToken(account) {
|
|
73
74
|
return !!storedByoToken(account);
|
|
74
75
|
}
|
|
76
|
+
/** A sign-in preset's account (0perator Free) is the Operator sign-in itself: no key is ever stored for it. */
|
|
77
|
+
const signInAccount = (account) => Object.values(BYO_PRESETS).some((p) => p.signIn && p.account === account);
|
|
75
78
|
function storedByoToken(account) {
|
|
79
|
+
if (signInAccount(account))
|
|
80
|
+
return process.env.KODE_OPERATOR_TOKEN?.trim() || getOperatorToken();
|
|
76
81
|
const env = process.env[envName(account)];
|
|
77
82
|
if (env)
|
|
78
83
|
return env.trim() || undefined;
|
package/dist/cli.js
CHANGED
|
@@ -2574,7 +2574,7 @@ function Root() {
|
|
|
2574
2574
|
if (boot === "checking")
|
|
2575
2575
|
return _jsx(Text, { dimColor: true, children: bootDetail || "connecting to Operator…" });
|
|
2576
2576
|
if (boot === "down") {
|
|
2577
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: "Can't reach Operator on the configured endpoint." }), bootDetail ? _jsx(Text, { dimColor: true, children: bootDetail }) : null,
|
|
2577
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: "Can't reach Operator on the configured endpoint." }), bootDetail ? _jsx(Text, { dimColor: true, children: bootDetail }) : null, _jsxs(Text, { dimColor: true, children: ["The Operator model is launchd-owned. Recover it with: launchctl kickstart -k gui/$(id -u)/", settings.services?.aurora?.launchdLabel ?? "co.0perator.gateway"] })] }));
|
|
2578
2578
|
}
|
|
2579
2579
|
// While a turn runs, show a LIVE line: braille spinner + climbing token count + live tok/s + elapsed
|
|
2580
2580
|
// seconds. When idle, show the last turn's final "N tok · X tok/s · Ys". Never freeze on the previous
|
package/dist/config/settings.js
CHANGED
|
@@ -63,15 +63,16 @@ const DEFAULTS = {
|
|
|
63
63
|
permissions: { mode: "gated" }, // ask-by-default: the user decides Allow/Deny; bypass is the opt-out
|
|
64
64
|
telemetry: { enabled: true }, // local-only metrics (silent JSONL); remote sink opt-in via KODE_TELEMETRY_URL
|
|
65
65
|
sandbox: { mode: "off" }, // no isolation by default — enterprise turns it on (KODE_SANDBOX / settings)
|
|
66
|
-
computer: { enabled:
|
|
66
|
+
computer: { enabled: true }, // computer control ON (every action asks; bg agents denied; macOS TCC on top). Off: KODE_COMPUTER=0, settings.json or managed policy
|
|
67
67
|
sessionSearch: { enabled: true }, // /sessions + session_search over Operator's and agents.md providers' sessions; per-provider switches in sources; KODE_SESSION_SEARCH=0 to disable
|
|
68
68
|
search: {}, // web_search backend unset by default; set search.searxngUrl / search.autopilotUrl or the env vars
|
|
69
69
|
// Service lever — JL1 defaults. On a machine without these launchd agents every start step just fails
|
|
70
70
|
// harmlessly and the boot screen falls back to the manual hint (autostart is best-effort by design).
|
|
71
71
|
services: {
|
|
72
|
-
|
|
72
|
+
// co.0perator.* since 2026-10-28; legacyLabels keeps a box that still runs the old job self-healing.
|
|
73
|
+
aurora: { autostart: true, launchdLabel: "co.0perator.gateway", plistPath: "~/Library/LaunchAgents/co.0perator.gateway.plist", legacyLabels: ["ai.operator.gateway"], waitSec: 90 },
|
|
73
74
|
autopilot: { autostart: true, launchdLabel: "com.axe.autopilot", plistPath: "~/Library/LaunchAgents/com.axe.autopilot.plist", url: "http://127.0.0.1:9333" },
|
|
74
|
-
vision: { autostart: false, launchdLabel: "
|
|
75
|
+
vision: { autostart: false, launchdLabel: "co.0perator.vision", plistPath: "~/Library/LaunchAgents/co.0perator.vision.plist", legacyLabels: ["axe.vision-bot"], url: "http://127.0.0.1:7788", remoteUrl: "http://192.168.1.103:8095" },
|
|
75
76
|
stopOnExit: { searxng: true }, // aurora/autopilot are shared + never stopped; only the SearXNG container is
|
|
76
77
|
},
|
|
77
78
|
activeModel: DEFAULT_MODEL_ID, // /model default — the 1M endpoint, unchanged from before /model existed
|
|
@@ -180,6 +181,8 @@ function applyEnv(s) {
|
|
|
180
181
|
out.sandbox = { mode: sb };
|
|
181
182
|
if (process.env.KODE_COMPUTER === "1")
|
|
182
183
|
out.computer = { enabled: true };
|
|
184
|
+
else if (process.env.KODE_COMPUTER === "0")
|
|
185
|
+
out.computer = { enabled: false };
|
|
183
186
|
// Service lever: KODE_SERVICES_AUTOSTART=0 disables autostart of ALL launchd services (Operator then
|
|
184
187
|
// only probes + reports); KODE_STOP_SEARXNG_ON_EXIT=0 keeps the SearXNG container running after exit.
|
|
185
188
|
if (out.services) {
|
|
@@ -85,7 +85,8 @@ export function freeModelLabel(id) {
|
|
|
85
85
|
}
|
|
86
86
|
function freeProfile(row, preset) {
|
|
87
87
|
const params = paramsFromId(row.id);
|
|
88
|
-
const
|
|
88
|
+
const stated = typeof row.expiration_date === "string" && /^\d{4}-\d{2}-\d{2}/.test(row.expiration_date) ? row.expiration_date.slice(0, 10) : undefined;
|
|
89
|
+
const expiry = stated ?? Object.entries(PROMO_EXPIRY).find(([frag]) => row.id.includes(frag))?.[1];
|
|
89
90
|
return {
|
|
90
91
|
id: `${preset.account}-${freeModelSlug(row.id)}`,
|
|
91
92
|
label: freeModelLabel(row.id),
|
|
@@ -93,7 +94,7 @@ function freeProfile(row, preset) {
|
|
|
93
94
|
box: `${preset.box ?? preset.label} · free`,
|
|
94
95
|
kind: "single",
|
|
95
96
|
tier: "free",
|
|
96
|
-
desc: `${FREE_TIER_CAVEAT}${expiry ? `, expires ${expiry}` : ""}`,
|
|
97
|
+
desc: `${preset.freeCaveat ?? FREE_TIER_CAVEAT}${expiry ? `, expires ${expiry}` : ""}`,
|
|
97
98
|
endpoint: preset.endpoint,
|
|
98
99
|
model: row.id,
|
|
99
100
|
ctx: typeof row.context_length === "number" && row.context_length > 0 ? row.context_length : DEFAULT_FREE_CTX,
|
package/dist/router/models.js
CHANGED
|
@@ -132,6 +132,7 @@ export const BUILTIN_MODELS = [
|
|
|
132
132
|
// ── orchestrated ────────────────────────────────────────────────────────────────────────────────────────
|
|
133
133
|
{ id: "moa", tier: "power_turbo", label: "MOA", box: "mixture of agents", kind: "orchestrated", desc: "the team slot — fans each turn to aurora-local + Cortana + Qwen2.5-Coder proposers (settings.moa, 60s fan-out, graceful per-draft failure) and synthesizes with local Aurora as agent-loop aggregator; roster + benchmark in _ai-docs" },
|
|
134
134
|
];
|
|
135
|
+
export const OPERATOR_FREE_ACCOUNT = "0perator";
|
|
135
136
|
export const BYO_PRESETS = {
|
|
136
137
|
openai: { label: "OpenAI", box: "OpenAI", endpoint: "https://api.openai.com/v1", model: "gpt-5", ctx: 272000, account: "openai", envAlias: "OPENAI_API_KEY" },
|
|
137
138
|
anthropic: { label: "Anthropic", box: "Anthropic", endpoint: ANTHROPIC_BASE, model: "claude-sonnet-5-5", ctx: 1000000, account: "anthropic", transport: "anthropic", envAlias: "ANTHROPIC_API_KEY" },
|
|
@@ -145,6 +146,9 @@ export const BYO_PRESETS = {
|
|
|
145
146
|
qwen: { label: "QwenCloud", box: "QwenCloud", endpoint: QWEN_BASE, model: "qwen3.8-max", ctx: 262144, account: "qwen" },
|
|
146
147
|
// Nous Portal — the free cloud tier (router/free-models.ts lists its `:free` rows once this key is connected;
|
|
147
148
|
// the vendor requires an account even for free models). 50 RPM / 500k TPM; prompts may be used for training.
|
|
149
|
+
// 0perator's own free catalog (portal router behind AuthGate): the free models we serve with OUR provider accounts,
|
|
150
|
+
// listed for every signed-in Operator with no vendor key. The rows come from its /models (pricing 0).
|
|
151
|
+
operator: { label: "0perator Free", box: "0perator", endpoint: `https://${PRODUCT_API_HOST}/free/v1`, model: "nvidia/nemotron-3-ultra-550b-a55b:free", ctx: 262144, account: OPERATOR_FREE_ACCOUNT, transport: "openai", signIn: true, freeCaveat: "free via 0perator — the model's provider may log or train on prompts; shared rate limits" },
|
|
148
152
|
nous: { label: "Nous Portal", box: "Nous", endpoint: NOUS_BASE, model: "reflection/beam-1.0-501b-a23b:free", ctx: 262144, account: "nous", transport: "openai", envAlias: "NOUS_API_KEY" },
|
|
149
153
|
};
|
|
150
154
|
/** The vendor env var a BYO account answers to (ByoPreset.envAlias), or undefined for an account no preset names. */
|
|
@@ -75,6 +75,19 @@ async function waitReady(url, okOnly, waitSec) {
|
|
|
75
75
|
* mid-load model. If nothing is listening, restart the loaded job, else bootout any half-state and
|
|
76
76
|
* bootstrap the plist fresh, then poll. Best-effort by construction — on a machine without that agent
|
|
77
77
|
* every launchctl step fails and we return "down" with the reason so the caller shows the manual hint. */
|
|
78
|
+
/** A box not yet moved to the co.0perator.* labels (2026-10-28) still has the job under an older one: when the
|
|
79
|
+
* configured plist is not on disk but a legacy plist beside it is, drive that job instead of reporting "not installed". */
|
|
80
|
+
async function withLegacyLabel(cfg) {
|
|
81
|
+
if (!cfg.plistPath || !cfg.legacyLabels?.length || (await fileExists(expandHome(cfg.plistPath))))
|
|
82
|
+
return cfg;
|
|
83
|
+
const dir = cfg.plistPath.slice(0, cfg.plistPath.lastIndexOf("/"));
|
|
84
|
+
for (const legacy of cfg.legacyLabels) {
|
|
85
|
+
const plistPath = `${dir}/${legacy}.plist`;
|
|
86
|
+
if (await fileExists(expandHome(plistPath)))
|
|
87
|
+
return { ...cfg, launchdLabel: legacy, plistPath };
|
|
88
|
+
}
|
|
89
|
+
return cfg;
|
|
90
|
+
}
|
|
78
91
|
async function ensureLaunchd(name, healthUrl, okOnly, cfg, onProgress) {
|
|
79
92
|
const waitSec = cfg.waitSec ?? 45;
|
|
80
93
|
const first = await probe(healthUrl, okOnly);
|
|
@@ -89,6 +102,7 @@ async function ensureLaunchd(name, healthUrl, okOnly, cfg, onProgress) {
|
|
|
89
102
|
}
|
|
90
103
|
if (cfg.autostart === false)
|
|
91
104
|
return { name, state: "down", detail: "down (autostart off)" };
|
|
105
|
+
cfg = await withLegacyLabel(cfg);
|
|
92
106
|
const label = cfg.launchdLabel;
|
|
93
107
|
const uid = typeof process.getuid === "function" ? process.getuid() : NaN;
|
|
94
108
|
if (!label || Number.isNaN(uid))
|
|
@@ -222,8 +236,9 @@ export function ensureVisionUp(url = "http://127.0.0.1:7788") {
|
|
|
222
236
|
}
|
|
223
237
|
const r = await ensureLaunchd("vision", `${url.replace(/\/$/, "")}/health`, true, {
|
|
224
238
|
autostart: true,
|
|
225
|
-
launchdLabel: "
|
|
226
|
-
plistPath: "~/Library/LaunchAgents/
|
|
239
|
+
launchdLabel: "co.0perator.vision",
|
|
240
|
+
plistPath: "~/Library/LaunchAgents/co.0perator.vision.plist",
|
|
241
|
+
legacyLabels: ["axe.vision-bot"],
|
|
227
242
|
waitSec: 12, // qwen2.5vl:7b is an ollama-backed worker — a cold load is seconds, not minutes
|
|
228
243
|
});
|
|
229
244
|
const ok = r.state === "up" || r.state === "started";
|
package/dist/ui/modelPicker.js
CHANGED
|
@@ -10,7 +10,7 @@ import { DISCUSS } from "./QuestionPrompt.js";
|
|
|
10
10
|
export const CONNECT_ROW = "+ Connect a provider key (Anthropic, Google, Nous, OpenAI, …)";
|
|
11
11
|
/** Presets whose zero-price rows /model lists once their key is connected (router/free-models.ts) — OpenRouter's
|
|
12
12
|
* `:free` listing joins here. */
|
|
13
|
-
export const FREE_ROW_PRESETS = ["nous"];
|
|
13
|
+
export const FREE_ROW_PRESETS = ["operator", "nous"];
|
|
14
14
|
// fleet → connected providers → free rows → MOA. The built-ins already list this box (JL2) before JL1.
|
|
15
15
|
const group = (m) => (m.kind === "orchestrated" ? 3 : m.tier === "free" ? 2 : m.byo ? 1 : 0);
|
|
16
16
|
/** The picker order of a visible registry: fleet rows, the connected providers, the free rows, then MOA — a stable
|
|
@@ -77,7 +77,7 @@ export function connectedAccounts(has, presets = BYO_PRESETS) {
|
|
|
77
77
|
/** The provider rows, from the presets in their order — never listByoAccounts, which sees only the file tier:
|
|
78
78
|
* `<label>`, plus " ✓ connected" for an account in `connected`. */
|
|
79
79
|
export function providerPickerView(connected, presets = BYO_PRESETS) {
|
|
80
|
-
const choices = Object.entries(presets).map(([preset, p]) => ({ preset, p }));
|
|
80
|
+
const choices = Object.entries(presets).filter(([, p]) => !p.signIn).map(([preset, p]) => ({ preset, p }));
|
|
81
81
|
return { rows: choices.map(({ p }) => `${p.label}${connected.has(p.account) ? " ✓ connected" : ""}`), choices };
|
|
82
82
|
}
|
|
83
83
|
/** What a QuestionPrompt answer means for a picker whose rows were drawn from `entries`: the row picked (by index), the
|