@0perator/operator 0.2.2-next.1 → 0.2.5
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/autonomy/index.js +14 -5
- package/dist/autonomy/session-factory.js +7 -1
- package/dist/cli.js +90 -19
- package/dist/config/features.js +7 -0
- package/dist/config/persona.js +6 -3
- package/dist/config/settings.js +17 -0
- package/dist/engine/agent.js +8 -0
- package/dist/engine/aurora.js +51 -12
- package/dist/engine/batch-hints.js +45 -0
- package/dist/engine/batch-scheduler.js +23 -7
- package/dist/engine/compaction.js +8 -1
- package/dist/engine/messages.js +5 -0
- package/dist/engine/native-vision-node.js +88 -10
- package/dist/engine/native-vision.js +25 -7
- package/dist/engine/rolling-summary.js +3 -2
- package/dist/engine/router-adapter.js +1 -0
- package/dist/engine/speed-compaction.js +7 -0
- package/dist/engine/token-meter.js +1 -1
- package/dist/mcp/index.js +2 -2
- package/dist/products/voice.js +44 -9
- package/dist/router/activation.js +132 -0
- package/dist/router/discovery.js +4 -3
- package/dist/router/model-list.js +79 -0
- package/dist/router/models.js +12 -1
- package/dist/router/router.js +0 -11
- package/dist/session.js +239 -33
- package/dist/tools/classes.js +2 -0
- package/dist/tools/deferred.js +11 -6
- package/dist/tools/executor.js +17 -3
- package/dist/tools/micro-assist.js +105 -0
- package/dist/tools/read-ledger.js +4 -0
- package/dist/tools/readonly-shell.js +92 -0
- package/dist/tools/registry.js +68 -61
- package/dist/tools/sandbox.js +1 -1
- package/dist/tools/semantic-compress.js +1 -9
- package/dist/tools/shell-session.js +56 -1
- package/dist/tools/tool-output-spill.js +1 -1
- package/dist/ui/ActivitySpinner.js +2 -2
- package/dist/ui/App.js +8 -8
- package/dist/ui/ApprovalPrompt.js +5 -4
- package/dist/ui/ArtifactPicker.js +4 -3
- package/dist/ui/AuthScreen.js +2 -1
- package/dist/ui/BgPanel.js +6 -6
- package/dist/ui/Composer.js +4 -3
- package/dist/ui/Header.js +2 -2
- package/dist/ui/Markdown.js +50 -77
- package/dist/ui/PlanPane.js +5 -5
- package/dist/ui/QuestionPrompt.js +2 -1
- package/dist/ui/SecretPrompt.js +2 -1
- package/dist/ui/SessionPicker.js +4 -3
- package/dist/ui/SkillFinder.js +3 -2
- package/dist/ui/StatsCard.js +2 -2
- package/dist/ui/StatusRule.js +2 -2
- package/dist/ui/SummaryCard.js +2 -2
- package/dist/ui/Table.js +25 -24
- package/dist/ui/ThinkingSpinner.js +2 -1
- package/dist/ui/ToolBatch.js +3 -3
- package/dist/ui/ToolStep.js +4 -4
- package/dist/ui/Transcript.js +12 -12
- package/dist/ui/UpdatePrompt.js +2 -1
- package/dist/ui/activationFlow.js +126 -0
- package/dist/ui/inline.js +109 -0
- package/dist/ui/modelPicker.js +12 -7
- package/dist/ui/theme.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// A settings.models row may carry `activation`: the owner's command that makes that model the served one (a box that
|
|
2
|
+
// holds one large model at a time has to load it first). The command is read from the owner's settings file only —
|
|
3
|
+
// never from the merged registry, which also carries gateway-fed rows — and runs as argv, with no shell.
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
import { closeSync, mkdirSync, openSync, readFileSync } from "node:fs";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { dirname } from "node:path";
|
|
8
|
+
import { operatorPath } from "../config/home.js";
|
|
9
|
+
import { ownChild } from "../util/owned-children.js";
|
|
10
|
+
import { ownerModelEntries } from "../config/settings.js";
|
|
11
|
+
const isArgv = (v) => Array.isArray(v) && v.length > 0 && v.every((a) => typeof a === "string") && v[0] !== "";
|
|
12
|
+
export function activationOf(entry) {
|
|
13
|
+
const raw = entry?.activation;
|
|
14
|
+
if (raw === undefined)
|
|
15
|
+
return {};
|
|
16
|
+
const a = raw;
|
|
17
|
+
if (!a || !isArgv(a.command) || (a.check !== undefined && !isArgv(a.check)) || (a.force !== undefined && !isArgv(a.force))) {
|
|
18
|
+
return { error: "settings.models activation is not usable: command, check and force are argv arrays of strings" };
|
|
19
|
+
}
|
|
20
|
+
return { activation: { command: a.command, ...(a.check ? { check: a.check } : {}), ...(a.force ? { force: a.force } : {}) } };
|
|
21
|
+
}
|
|
22
|
+
export function ownerActivation(id) {
|
|
23
|
+
return activationOf(ownerModelEntries().filter((m) => m.id === id && m.activation !== undefined).pop());
|
|
24
|
+
}
|
|
25
|
+
const expandHome = (a) => (a.startsWith("~/") ? homedir() + a.slice(1) : a);
|
|
26
|
+
export const commandLine = (argv) => argv.map((a) => (/\s/.test(a) ? JSON.stringify(a) : a)).join(" ");
|
|
27
|
+
const outputLines = (text) => text.split("\n").map((l) => l.replace(/[\x00-\x08\x0b-\x1f\x7f]/g, "").trimEnd()).filter(Boolean);
|
|
28
|
+
const tail = (lines, n = 3) => lines.slice(-n).join(" · ");
|
|
29
|
+
export const CHECK_TIMEOUT_MS = 90_000;
|
|
30
|
+
export function checkActivation(a, timeoutMs = CHECK_TIMEOUT_MS) {
|
|
31
|
+
if (!a.check)
|
|
32
|
+
return Promise.resolve({ state: "switch", plan: `plan: run ${commandLine(a.command)}` });
|
|
33
|
+
const [bin, ...args] = a.check.map(expandHome);
|
|
34
|
+
return new Promise((resolve) => {
|
|
35
|
+
let text = "", timedOut = false;
|
|
36
|
+
const child = spawn(bin, args, { stdio: ["ignore", "pipe", "pipe"], shell: false });
|
|
37
|
+
ownChild(child, "model switch check");
|
|
38
|
+
const keep = (b) => { text = (text + b.toString("utf8")).slice(-16_384); };
|
|
39
|
+
child.stdout.on("data", keep);
|
|
40
|
+
child.stderr.on("data", keep);
|
|
41
|
+
const timer = setTimeout(() => { timedOut = true; child.kill("SIGKILL"); }, timeoutMs);
|
|
42
|
+
child.on("error", (e) => { clearTimeout(timer); resolve({ state: "error", reason: e.message }); });
|
|
43
|
+
child.on("close", (code) => {
|
|
44
|
+
clearTimeout(timer);
|
|
45
|
+
if (timedOut) {
|
|
46
|
+
resolve({ state: "error", reason: `the check did not answer in ${Math.round(timeoutMs / 1000)} s` });
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const lines = outputLines(text);
|
|
50
|
+
const plan = lines.find((l) => l.startsWith("plan:"));
|
|
51
|
+
const refusal = lines.find((l) => l.startsWith("would refuse:"));
|
|
52
|
+
if (code !== 0 && !refusal)
|
|
53
|
+
resolve({ state: "error", reason: tail(lines) || `the check exited ${code}` });
|
|
54
|
+
else if (!plan && !refusal)
|
|
55
|
+
resolve({ state: "serving" });
|
|
56
|
+
else
|
|
57
|
+
resolve({ state: "switch", plan: plan ?? `plan: run ${commandLine(a.command)}`, ...(refusal ? { refusal } : {}) });
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function activationLogPath(id) {
|
|
62
|
+
return operatorPath("activation", `${new Date().toISOString().replace(/[:.]/g, "-")}-${id.replace(/[^\w.-]/g, "_")}.log`);
|
|
63
|
+
}
|
|
64
|
+
/** Start the command in its own process group, writing to a file, so it survives the picker and Operator itself: a
|
|
65
|
+
* switch cut off half way (a closed pipe, a ctrl+c) can leave nothing served. It holds no handle on the event loop. */
|
|
66
|
+
export function startActivation(argv, log) {
|
|
67
|
+
const [bin, ...args] = argv.map(expandHome);
|
|
68
|
+
const t0 = Date.now();
|
|
69
|
+
let stopped = false, ended;
|
|
70
|
+
const lines = () => { try {
|
|
71
|
+
return outputLines(readFileSync(log, "utf8").slice(-16_384));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return [];
|
|
75
|
+
} };
|
|
76
|
+
mkdirSync(dirname(log), { recursive: true });
|
|
77
|
+
const fd = openSync(log, "w", 0o600);
|
|
78
|
+
// owned-exempt: a switch cut off half way can leave no model loaded, so it outlives the session
|
|
79
|
+
const child = spawn(bin, args, { stdio: ["ignore", fd, fd], shell: false, detached: true });
|
|
80
|
+
closeSync(fd);
|
|
81
|
+
child.unref();
|
|
82
|
+
const done = new Promise((resolve) => {
|
|
83
|
+
child.on("error", (e) => { ended = Date.now(); resolve({ ok: false, stopped, reason: e.message }); });
|
|
84
|
+
child.on("exit", (code, signal) => {
|
|
85
|
+
ended = Date.now();
|
|
86
|
+
const out = lines();
|
|
87
|
+
const ok = code === 0;
|
|
88
|
+
const refusal = ok || stopped ? undefined : out.slice(-3).find((l) => /answering right now|^would refuse:/.test(l));
|
|
89
|
+
resolve({ ok, stopped: stopped && !ok, reason: tail(out) || `the command ${signal ? `ended on ${signal}` : `exited ${code}`}`, ...(refusal ? { refusal } : {}) });
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
log, lines, done,
|
|
94
|
+
elapsedMs: () => (ended ?? Date.now()) - t0,
|
|
95
|
+
stop: () => {
|
|
96
|
+
if (ended !== undefined || child.pid === undefined)
|
|
97
|
+
return;
|
|
98
|
+
stopped = true;
|
|
99
|
+
try {
|
|
100
|
+
process.kill(-child.pid, "SIGTERM");
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
child.kill("SIGTERM");
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** `operator run --activate`: make the run's model the served one first. Never forces. Returns why it could not. */
|
|
109
|
+
export async function activateForRun(id, entry, write) {
|
|
110
|
+
if (entry.error)
|
|
111
|
+
return entry.error;
|
|
112
|
+
const a = entry.activation;
|
|
113
|
+
if (!a)
|
|
114
|
+
return undefined;
|
|
115
|
+
const check = await checkActivation(a);
|
|
116
|
+
if (check.state === "serving")
|
|
117
|
+
return undefined;
|
|
118
|
+
if (check.state === "error")
|
|
119
|
+
return `${id}: activation check failed: ${check.reason}`;
|
|
120
|
+
if (check.refusal)
|
|
121
|
+
return `${id}: not activated: ${check.refusal}`;
|
|
122
|
+
const run = startActivation(a.command, activationLogPath(id));
|
|
123
|
+
write(`[activate ${id}] ${check.plan}\n[activate ${id}] log ${run.log} (ctrl+c leaves the switch running)\n`);
|
|
124
|
+
let shown = 0;
|
|
125
|
+
const flush = () => { const all = run.lines(); for (const l of all.slice(shown))
|
|
126
|
+
write(`[activate ${id}] ${l}\n`); shown = all.length; };
|
|
127
|
+
const timer = setInterval(flush, 1000);
|
|
128
|
+
const r = await run.done;
|
|
129
|
+
clearInterval(timer);
|
|
130
|
+
flush();
|
|
131
|
+
return r.ok ? undefined : `${id}: not activated: ${r.refusal ?? r.reason}`;
|
|
132
|
+
}
|
package/dist/router/discovery.js
CHANGED
|
@@ -77,7 +77,8 @@ export async function probeServedCtx(base, opts = {}) {
|
|
|
77
77
|
/** probeServedCtx plus the server's slot count: llama.cpp `/props` `total_slots`, or the router's `total_slots` on
|
|
78
78
|
* `GET /v1/models/<model>`. Null where the endpoint does not say (a router that predates the field, a vendor).
|
|
79
79
|
* `direct` is true only when the base answered `/props` with `total_slots` itself: it IS a llama-server, not a
|
|
80
|
-
* router or gateway in front of one (those serve no `/props`).
|
|
80
|
+
* router or gateway in front of one (those serve no `/props`). `fleetOnly`: the router vouches that every leg of this
|
|
81
|
+
* model's route is a llama-server on a private address (`fleet_only` on its row); false when it says nothing. */
|
|
81
82
|
export async function probeServed(base, opts = {}) {
|
|
82
83
|
const timeoutMs = opts.timeoutMs ?? DEFAULTS.timeoutMs;
|
|
83
84
|
const f = opts.fetchImpl ?? fetch;
|
|
@@ -87,9 +88,9 @@ export async function probeServed(base, opts = {}) {
|
|
|
87
88
|
const nCtx = props ? nCtxOf(props) : null;
|
|
88
89
|
const own = positive(props?.total_slots);
|
|
89
90
|
if (nCtx || !opts.model)
|
|
90
|
-
return { ctx: nCtx, slots: own, direct: own !== null };
|
|
91
|
+
return { ctx: nCtx, slots: own, direct: own !== null, fleetOnly: false };
|
|
91
92
|
const row = await getJson(`${bare.endsWith("/v1") ? bare : v1(bare)}/models/${encodeURIComponent(opts.model)}`, timeoutMs, f);
|
|
92
|
-
return { ctx: positive(row?.context_length), slots: positive(row?.total_slots), direct: false };
|
|
93
|
+
return { ctx: positive(row?.context_length), slots: positive(row?.total_slots), direct: false, fleetOnly: row?.fleet_only === true };
|
|
93
94
|
}
|
|
94
95
|
/** Probe one fleet base and build a ModelProfile from what the SERVER reports, or null if it doesn't
|
|
95
96
|
* answer `/props` in time (→ absent from the picker). `/props` is the source of truth for the context
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// The short model list the gateway publishes on its /v1/models rows (portal registry `picker`). Ids, labels, order and
|
|
2
|
+
// who sees a row are the gateway's data, so a row is added, renamed or removed there with no change here. A gateway that
|
|
3
|
+
// cannot be read leaves the last list read; with none, /model keeps its built-in rows. Never throws.
|
|
4
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { dirname } from "node:path";
|
|
6
|
+
import { operatorPath } from "../config/home.js";
|
|
7
|
+
import { authHeaders, getOperatorToken } from "../engine/aurora.js";
|
|
8
|
+
import { catalogRows, DEFAULT_FREE_CTX } from "./free-models.js";
|
|
9
|
+
import { BUILTIN_MODELS, GATEWAY_BASE, LOCAL_GATEWAY_BASE, MODEL_ALIASES, RETIRED_MODEL_IDS } from "./models.js";
|
|
10
|
+
const ID = /^[a-z0-9][a-z0-9._:/-]{0,127}$/;
|
|
11
|
+
const defaultCache = () => operatorPath("model-list.json");
|
|
12
|
+
/** Pure: the listed rows of a catalog, in list order. A row with an unusable id or label is dropped. */
|
|
13
|
+
export function pickList(rows) {
|
|
14
|
+
const out = [];
|
|
15
|
+
for (const row of rows) {
|
|
16
|
+
const r = row;
|
|
17
|
+
if (r?.pickable !== true || typeof r.id !== "string" || !ID.test(r.id) || RETIRED_MODEL_IDS.has(r.id) || Object.hasOwn(MODEL_ALIASES, r.id))
|
|
18
|
+
continue;
|
|
19
|
+
if (typeof r.label !== "string" || !r.label.trim() || r.label.length > 80 || /[\u0000-\u001f\u007f-\u009f]/.test(r.label) || out.some((m) => m.id === r.id))
|
|
20
|
+
continue;
|
|
21
|
+
const ctx = typeof r.context_length === "number" && r.context_length > 0 ? r.context_length : undefined;
|
|
22
|
+
out.push({ id: r.id, label: r.label.trim(), order: typeof r.order === "number" ? r.order : out.length + 1, ...(ctx ? { ctx } : {}), paid: r.billing === "paid", thirdParty: r.hosting === "third_party", down: r.available === false });
|
|
23
|
+
}
|
|
24
|
+
return out.sort((a, b) => a.order - b.order);
|
|
25
|
+
}
|
|
26
|
+
/** The listed rows as profiles. A row settings.models names is left to settings; a built-in gateway row takes the list's
|
|
27
|
+
* label; a built-in on any other host is never re-pointed or renamed; an unknown id becomes a gateway row with no tier,
|
|
28
|
+
* so nothing picks it but the owner. Hosts are always ours: the list names models, never addresses. */
|
|
29
|
+
export function listedProfiles(list, own = []) {
|
|
30
|
+
return list.flatMap((r) => {
|
|
31
|
+
const built = BUILTIN_MODELS.find((m) => m.id === r.id);
|
|
32
|
+
if (own.some((m) => m.id === r.id) || (built && built.endpoint !== LOCAL_GATEWAY_BASE))
|
|
33
|
+
return [];
|
|
34
|
+
const base = built ?? { id: r.id, label: r.label, kind: "single", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: [r.id, r.id], model: r.id, ctx: DEFAULT_FREE_CTX };
|
|
35
|
+
return [{
|
|
36
|
+
...base, label: r.label, params: undefined, hidden: false, tier: built && !built.hidden ? built.tier : undefined,
|
|
37
|
+
box: [r.thirdParty ? "third party" : "gateway", ...(r.paid ? ["paid"] : [])].join(", "),
|
|
38
|
+
desc: r.thirdParty ? "served by a third party through our gateway" : "served by our gateway",
|
|
39
|
+
...(r.ctx ? { ctx: r.ctx } : {}),
|
|
40
|
+
...(r.thirdParty ? { transport: "openai", maxOutput: 32768 } : {}),
|
|
41
|
+
}];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** The last list read, so a saved pick still resolves at the next start. Availability is never remembered. */
|
|
45
|
+
export function cachedModelList(path = defaultCache()) {
|
|
46
|
+
try {
|
|
47
|
+
const rows = catalogRows(JSON.parse(readFileSync(path, "utf8")));
|
|
48
|
+
return rows ? pickList(rows) : [];
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function remember(list, path) {
|
|
55
|
+
const data = list.map((m) => ({ pickable: true, id: m.id, label: m.label, order: m.order, context_length: m.ctx, billing: m.paid ? "paid" : undefined, hosting: m.thirdParty ? "third_party" : undefined }));
|
|
56
|
+
try {
|
|
57
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
58
|
+
writeFileSync(path, JSON.stringify({ data }), { mode: 0o600 });
|
|
59
|
+
}
|
|
60
|
+
catch { /* an unwritable home costs only the restart */ }
|
|
61
|
+
}
|
|
62
|
+
/** The list from the local gateway, else (signed in) the public one: the first that answers decides, and an answer with
|
|
63
|
+
* no listed row means there is no list. undefined: nothing could be read. */
|
|
64
|
+
export async function fetchModelList(opts = {}) {
|
|
65
|
+
const f = opts.fetchImpl ?? fetch;
|
|
66
|
+
for (const base of [LOCAL_GATEWAY_BASE, ...(opts.cloud !== false && getOperatorToken() ? [GATEWAY_BASE] : [])]) {
|
|
67
|
+
try {
|
|
68
|
+
const res = await f(`${base}/models`, { headers: { Accept: "application/json", ...authHeaders({ base, model: "" }) }, signal: AbortSignal.timeout(opts.timeoutMs ?? 4000) });
|
|
69
|
+
const rows = res.ok ? catalogRows(await res.json()) : undefined;
|
|
70
|
+
if (!rows)
|
|
71
|
+
continue;
|
|
72
|
+
const list = pickList(rows);
|
|
73
|
+
remember(list, opts.cachePath ?? defaultCache());
|
|
74
|
+
return list;
|
|
75
|
+
}
|
|
76
|
+
catch { /* offline, timeout or junk: the next gateway */ }
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
package/dist/router/models.js
CHANGED
|
@@ -13,6 +13,17 @@
|
|
|
13
13
|
import { INFERENCE_API_HOST, LEGACY_API_HOST, PRODUCT_API_HOST } from "../config/product-hosts.js"; // no imports of its own — no cycle
|
|
14
14
|
/** Fallback walk order, strongest → cheapest. */
|
|
15
15
|
export const TIER_LADDER = ["power_turbo", "power", "economy", "lite", "free"];
|
|
16
|
+
export const EFFORT_LEVELS = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
17
|
+
/** A `/think` argument as a reasoning effort ("default" clears the override), or undefined for anything else. */
|
|
18
|
+
export function parseEffort(arg) {
|
|
19
|
+
const v = arg.trim().toLowerCase();
|
|
20
|
+
return v === "default" || EFFORT_LEVELS.includes(v) ? v : undefined;
|
|
21
|
+
}
|
|
22
|
+
/** The effort a model runs at: the saved `/think <level>` override, else its profile's. */
|
|
23
|
+
export function effortFor(overrides, profile) {
|
|
24
|
+
const own = overrides[profile.id];
|
|
25
|
+
return own && own !== "default" ? own : profile.reasoningEffort;
|
|
26
|
+
}
|
|
16
27
|
export function isRetired(p) {
|
|
17
28
|
return p?.status === "retired";
|
|
18
29
|
}
|
|
@@ -65,7 +76,7 @@ export const ANTHROPIC_MAX_OUTPUT = 128_000;
|
|
|
65
76
|
export const BUILTIN_MODELS = [
|
|
66
77
|
// ── main: the /model rows, in this order (ui/modelPicker.ts MAIN_MODEL_IDS; operator-dense hidden 11/30) ─────────────────
|
|
67
78
|
// Router routes of the same name, gateway-first like every gateway row. `ctx` is the window the route serves.
|
|
68
|
-
{ id: "operator-flash", tier: "power", label: "Operator-Flash", params: "125B-A6B", box: "gateway", kind: "single", desc: "the default model: a fast MoE with n-gram speculation", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["operator-flash", "operator-flash"], model: "operator-flash", ctx: 131072 },
|
|
79
|
+
{ id: "operator-flash", tier: "power", label: "Operator-Flash", params: "125B-A6B", box: "gateway", kind: "single", desc: "the default model: a fast MoE with n-gram speculation", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["operator-flash", "operator-flash"], model: "operator-flash", ctx: 131072, vision: true },
|
|
69
80
|
{ id: "kimi-linear-48b", tier: "power", label: "Kimi-Linear", params: "48B-A3B", box: "gateway", kind: "single", desc: "long-context MoE", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["kimi-linear-48b", "kimi-linear-48b"], model: "kimi-linear-48b", ctx: 262144 },
|
|
70
81
|
{ id: "operator-dense", tier: "power", label: "Operator-Dense", params: "27B", box: "gateway", kind: "single", desc: "dense model with n-gram and MTP speculation; loads on demand", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["operator-dense", "operator-dense"], model: "operator-dense", ctx: 131072, hidden: true },
|
|
71
82
|
// ── retired ─────────────────────────────────────────────────────────────────────────────────────────────
|
package/dist/router/router.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
// Endpoint routing & self-heal — SPEC §4. Two Aurora endpoints: Air (fast, small ctx) and
|
|
2
|
-
// 1M (slow, huge ctx). Interface consumed by the engine (Karpathy's lane):
|
|
3
|
-
// base, model -> current endpoint's connection info
|
|
4
|
-
// ctxLimit() -> current endpoint's context window
|
|
5
|
-
// routeBySize(n) -> pick the smallest endpoint that fits n tokens, escalating Air->1M as
|
|
6
|
-
// the conversation grows; NEVER moves to a smaller endpoint on its own
|
|
7
|
-
// escalate() -> jump straight to the largest endpoint (used on repeated 400s with no
|
|
8
|
-
// room left to compact)
|
|
9
|
-
// failover() -> hop to a healthy endpoint after a busy/5xx response; prefers a smaller
|
|
10
|
-
// endpoint over the one that just failed, per SPEC §4's "self-heal"
|
|
11
|
-
// KODE_NO_ROUTER=1 pins the router to whatever endpoint is current and disables all movement.
|
|
12
1
|
import { LOCAL_GATEWAY_BASE } from "./models.js";
|
|
13
2
|
// One endpoint by default: the local router's `main` (buildEndpointChain's built-in primary). The router still handles
|
|
14
3
|
// N endpoints generically.
|