@0perator/operator 0.1.313 → 0.1.321
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/agent-cli.js +6 -2
- package/dist/autonomy/cron.js +1 -1
- package/dist/autonomy/delegate.js +29 -4
- package/dist/autonomy/index.js +22 -0
- package/dist/autonomy/profile.js +1 -1
- package/dist/browser/cdp.js +1 -1
- package/dist/cli.js +119 -43
- package/dist/config/persona.js +29 -12
- package/dist/config/settings.js +12 -7
- package/dist/engine/agent.js +4 -2
- package/dist/engine/aurora.js +8 -3
- package/dist/engine/batch-scheduler.js +3 -3
- package/dist/engine/cli.js +1171 -0
- package/dist/engine/compaction.js +1 -1
- package/dist/engine/loop-guard.js +1 -1
- package/dist/engine/router-adapter.js +1 -0
- package/dist/idle/activity.js +20 -0
- package/dist/idle/index.js +5 -0
- package/dist/idle/monitor.js +71 -0
- package/dist/idle/policy.js +66 -0
- package/dist/idle/proc.js +22 -0
- package/dist/idle/reaper.js +69 -0
- package/dist/idle/session-record.js +59 -0
- package/dist/index.js +1 -1
- package/dist/mcp/config.js +72 -14
- package/dist/mcp/index.js +9 -2
- package/dist/memory/index.js +1 -1
- package/dist/permissions/index.js +22 -7
- package/dist/permissions/tier.js +1 -1
- package/dist/remote/host.js +20 -2
- package/dist/remote/safe-commands.js +38 -0
- package/dist/router/models.js.bak +78 -0
- package/dist/router/models.js.bak-1791259923 +78 -0
- package/dist/router/models.js.bak-pre-gateway +78 -0
- package/dist/router/models.js.bak-pre-patch2 +78 -0
- package/dist/router/models.js.bak2 +78 -0
- package/dist/services/model-autodetect.js +240 -0
- package/dist/services/preflight.js +54 -2
- package/dist/services/store-sync.js +111 -0
- package/dist/session-teardown.js +10 -1
- package/dist/session.js +22 -0
- package/dist/skills/catalogue.js +1 -1
- package/dist/tools/chauffeur-native.js +155 -0
- package/dist/tools/chauffeur.js +14 -3
- package/dist/tools/download.js +229 -0
- package/dist/tools/executor.js +1 -1
- package/dist/tools/monitoring-tools.js +312 -0
- package/dist/tools/native-redirect.js +140 -0
- package/dist/tools/paths.js +154 -0
- package/dist/tools/power-tools.js +627 -0
- package/dist/tools/registry.js +309 -18
- package/dist/tools/registry.js.bak-1791259948 +1914 -0
- package/dist/tools/registry.js.bak-pre-plugins +1914 -0
- package/dist/tools/shell-jobs.js +5 -2
- package/dist/tools/shell-session.js +4 -2
- package/dist/tools/tool-output-spill.js +1 -1
- package/dist/ui/BusTray.js +70 -0
- package/dist/ui/Composer.js +5 -2
- package/dist/ui/QuestionPrompt.js +1 -1
- package/dist/ui/ToolStep.js +16 -1
- package/dist/ui/liveTools.js +1 -1
- package/dist/ui/resize.js +160 -0
- package/dist/util/mentions.js +1 -1
- package/dist/vault/store.js +1 -1
- package/mcp/README.md +88 -0
- package/mcp/ocr-macos.swift +45 -0
- package/mcp/powertools-media.mjs +464 -0
- package/mcp/powertools-toolbox.mjs +1114 -0
- package/mcp/powertools.md +210 -0
- package/mcp/powertools.mjs +861 -0
- package/package.json +2 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Remote-control follower slash allowlist. Kept OUT of cli.tsx so tests can assert the security
|
|
2
|
+
// boundary without importing the Ink entry. Local `/help` / Composer menu use ui/slashCommands.ts
|
|
3
|
+
// (broader). A follower may ONLY drive names in this list — everything else is refused in onCommand.
|
|
4
|
+
//
|
|
5
|
+
// Deliberately EXCLUDES (in addition to exit/login/remote):
|
|
6
|
+
// mode — `/mode auto` flips host policy to bypass (ungated tool/MCP execution)
|
|
7
|
+
// mcp — `/mcp on` enables the full fleet MCP surface for the host session
|
|
8
|
+
// bg — spawns background agents with host privileges
|
|
9
|
+
// Those remain local-owner-only. A follower already has `prompt` (runs under current host mode);
|
|
10
|
+
// they must not escalate the host's permission/MCP posture.
|
|
11
|
+
//
|
|
12
|
+
// Preference: prefer `/pair` (QR e2e) over long-lived token RC when sharing a session — paired
|
|
13
|
+
// frames encrypt DATA payloads; token mode trusts the relay path. Escalation cmds stay host-local
|
|
14
|
+
// either way (this allowlist is the hard gate).
|
|
15
|
+
export const REMOTE_SAFE_COMMANDS = [
|
|
16
|
+
{ name: "help", description: "list available commands" },
|
|
17
|
+
{ name: "model", description: "pick a model: operator-1m · operator-128k · moa (mixture-of-agents)", args: "[id]" },
|
|
18
|
+
{ name: "route", description: "pin routing to an endpoint, or auto (by size)", args: "[endpoint|auto]" },
|
|
19
|
+
{ name: "endpoints", description: "show the Operator endpoint + live health" },
|
|
20
|
+
{ name: "services", description: "ensure/inspect the service lever (Operator+autopilot+searxng); stop searxng", args: "[stop]" },
|
|
21
|
+
{ name: "audit", description: "recent tool + control-plane events from the audit trail", args: "[n]" },
|
|
22
|
+
{ name: "dashboard", description: "launch the live swarm console" },
|
|
23
|
+
{ name: "plan", description: "toggle plan mode (read-only research + propose a plan)" },
|
|
24
|
+
{ name: "think", description: "toggle extended reasoning" },
|
|
25
|
+
{ name: "ultrathink", description: "toggle deep, exhaustive reasoning" },
|
|
26
|
+
{ name: "compact", description: "force-compact the conversation now" },
|
|
27
|
+
{ name: "remember", description: "store a note to recall in future sessions", args: "<note>" },
|
|
28
|
+
{ name: "memory", description: "show remembered notes", args: "[query]" },
|
|
29
|
+
{ name: "skill", description: "activate a skill as a system-prompt directive, or /skill off", args: "<name|off>" },
|
|
30
|
+
{ name: "whoami", description: "show signed-in identity" },
|
|
31
|
+
{ name: "agents", description: "detailed sub-agent status, or a per-agent deep view + controls", args: "[id] [msg <text>|stop]" },
|
|
32
|
+
{ name: "monitor", description: "toggle live event stream (tool decisions, turns, control)" },
|
|
33
|
+
{ name: "new", description: "start a fresh conversation" },
|
|
34
|
+
{ name: "clear", description: "clear the screen (keeps the conversation)" },
|
|
35
|
+
];
|
|
36
|
+
export const REMOTE_SAFE_COMMAND_NAMES = new Set(REMOTE_SAFE_COMMANDS.map((c) => c.name));
|
|
37
|
+
/** Escalation commands that stay owner-local (must never appear in REMOTE_SAFE_COMMAND_NAMES). */
|
|
38
|
+
export const REMOTE_ESCALATION_COMMANDS = ["mode", "mcp", "bg"];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const DEFAULT_MODEL_ID = "operator-1m";
|
|
2
|
+
// Back-compat aliases: the user-facing ids were renamed aurora-* -> operator-* (the outward name is
|
|
3
|
+
// Operator; "aurora" is the internal model, never shown). The OLD ids still resolve — a persisted
|
|
4
|
+
// settings.activeModel: "aurora-1m", a `/model aurora-1m`, or any muscle memory keeps working — so the
|
|
5
|
+
// rename loses nothing. The served model name ("aurora-code-1") + endpoints stay internal, untouched.
|
|
6
|
+
export const MODEL_ALIASES = {
|
|
7
|
+
"aurora-1m": "operator-1m",
|
|
8
|
+
"aurora-128k": "operator-128k",
|
|
9
|
+
};
|
|
10
|
+
export const BUILTIN_MODELS = [
|
|
11
|
+
{ id: "operator-1m", label: "Operator 300K", kind: "single", desc: "307,200-token (300K) context (:8097)", endpoint: "http://127.0.0.1:8097/v1", model: "aurora-code-1", ctx: 307200 },
|
|
12
|
+
{ id: "operator-128k", label: "Operator 128K", kind: "single", desc: "128K context, lighter RAM (:8096)", endpoint: "http://127.0.0.1:8096/v1", model: "aurora-code-1", ctx: 131072 },
|
|
13
|
+
// QwenCloud Token Plan BYO connectors (SPEC/providers.md §2 "API-key connectors"). Same keychain
|
|
14
|
+
// account ("qwen") serves both; the picker hides them until connected (§1 honest availability), and
|
|
15
|
+
// authHeaders NEVER sends the Operator token to this host. ctx starts conservative and self-clamps
|
|
16
|
+
// to the served truth (observeContext).
|
|
17
|
+
{ id: "qwen3.8-max", label: "Qwen 3.8 Max", kind: "single", desc: "BYO QwenCloud Token Plan — credits from your plan", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-max", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
18
|
+
{ id: "qwen3.8-flash", label: "Qwen 3.8 Flash", kind: "single", desc: "BYO QwenCloud Token Plan — fast tier, your credits", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-flash", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
19
|
+
// Venice 24B — SELF-HOSTED like Aurora (NOT a third-party connector): the open uncensored weights
|
|
20
|
+
// (Dolphin-Mistral-24B-Venice-Edition Q4_K_M, JL1 Ai Storage) served via llama.cpp on JL1:8110, bound
|
|
21
|
+
// 0.0.0.0 so the engine (on JL2) reaches it over LAN. Uncensored at the weights — answers directly, no
|
|
22
|
+
// retry needed; complements the engine-level unrestricted layer. Runs ALONGSIDE Aurora (:8097); the
|
|
23
|
+
// llama.cpp router health-checks + recovers, and ctx self-clamps to the served truth (observeContext).
|
|
24
|
+
{ id: "venice-24b", label: "Venice 24B (uncensored)", kind: "single", desc: "self-hosted uncensored Dolphin-Mistral-24B-Venice (fleet llama.cpp, JL1:8110)", endpoint: "http://192.168.1.103:8110/v1", model: "dolphin-venice-24b", ctx: 8192 },
|
|
25
|
+
{ id: "moa", label: "MOA (Mixture of Agents)", kind: "orchestrated", desc: "fan out to proposers, synthesize with an aggregator" },
|
|
26
|
+
];
|
|
27
|
+
/** The runtime registry: the built-ins, with any settings.models entries merged in (overriding a
|
|
28
|
+
* built-in by id, or adding a new one) — same shape either way, so /model doesn't care which. */
|
|
29
|
+
export function modelRegistry(overrides) {
|
|
30
|
+
if (!overrides?.length)
|
|
31
|
+
return BUILTIN_MODELS;
|
|
32
|
+
const byId = new Map(BUILTIN_MODELS.map((m) => [m.id, m]));
|
|
33
|
+
for (const m of overrides)
|
|
34
|
+
byId.set(m.id, { ...byId.get(m.id), ...m });
|
|
35
|
+
return [...byId.values()];
|
|
36
|
+
}
|
|
37
|
+
export function findModel(registry, id) {
|
|
38
|
+
const canon = MODEL_ALIASES[id] ?? id; // aurora-1m -> operator-1m (old ids keep resolving)
|
|
39
|
+
return registry.find((m) => m.id === canon);
|
|
40
|
+
}
|
|
41
|
+
/** The configured context window (tokens) for a model id — from BUILTIN_MODELS + settings overrides — or
|
|
42
|
+
* Infinity if unknown. Used to pick a LEAN harness: a small-context model (e.g. a self-hosted 8K Venice)
|
|
43
|
+
* can't take Operator's full memory + handoff injection (sized for Aurora's 300K); it fills the window and
|
|
44
|
+
* the model recites the memory instead of answering. Callers drop the heavy memory/handoff below a
|
|
45
|
+
* threshold while keeping the base persona (incl. the Direct/unrestricted section), so it stays uncensored. */
|
|
46
|
+
export function modelCtxFor(id, overrides) {
|
|
47
|
+
if (!id)
|
|
48
|
+
return Number.POSITIVE_INFINITY;
|
|
49
|
+
return findModel(modelRegistry(overrides), id)?.ctx ?? Number.POSITIVE_INFINITY;
|
|
50
|
+
}
|
|
51
|
+
/** ctx window below which the lean harness (no heavy memory/handoff) kicks in. Aurora/Qwen (128K+) stay
|
|
52
|
+
* full; a self-hosted small model (Venice 8K, or a 16K bump) goes lean. */
|
|
53
|
+
export const LEAN_HARNESS_CTX = 32768;
|
|
54
|
+
/** Pure selection reducer for /model — no I/O (no settings read/write, no router mutation), so it's
|
|
55
|
+
* directly testable. The moa-needs-config check lives in Session.setModel (it needs settings.moa,
|
|
56
|
+
* which this module intentionally doesn't import). `hasByo` (injected by the caller, see auth/byo)
|
|
57
|
+
* gates BYO connector profiles: honest "not connected" beats a request-time 401. */
|
|
58
|
+
export function selectModel(registry, id, hasByo) {
|
|
59
|
+
const profile = findModel(registry, id);
|
|
60
|
+
if (!profile)
|
|
61
|
+
return { error: `unknown model "${id}" — choices: ${registry.map((m) => m.id).join(", ")}` };
|
|
62
|
+
if (profile.kind === "single" && !profile.endpoint)
|
|
63
|
+
return { error: `model "${id}" has no endpoint configured` };
|
|
64
|
+
if (profile.byo && hasByo && !hasByo(profile.byo)) {
|
|
65
|
+
return { error: `"${id}" is not connected — store the ${profile.byo} key first: operator auth byo ${profile.byo}` };
|
|
66
|
+
}
|
|
67
|
+
return { profile };
|
|
68
|
+
}
|
|
69
|
+
/** The picker-truth view of a registry: drops BYO profiles whose key isn't connected (and ALL
|
|
70
|
+
* unresolvable ones when the resolver is absent — a picker must never offer what setModel refuses). */
|
|
71
|
+
export function visibleModels(registry, hasByo) {
|
|
72
|
+
return registry.filter((p) => !p.byo || (hasByo ? hasByo(p.byo) : false));
|
|
73
|
+
}
|
|
74
|
+
/** Strip a trailing /v1 so a ModelProfile/MoaAggregator endpoint can feed the AuroraRouter, whose
|
|
75
|
+
* base is bare (engine/aurora.ts's chat() appends /v1/chat/completions itself). */
|
|
76
|
+
export function endpointBase(endpoint) {
|
|
77
|
+
return endpoint.replace(/\/v1\/?$/, "");
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const DEFAULT_MODEL_ID = "operator-1m";
|
|
2
|
+
// Back-compat aliases: the user-facing ids were renamed aurora-* -> operator-* (the outward name is
|
|
3
|
+
// Operator; "aurora" is the internal model, never shown). The OLD ids still resolve — a persisted
|
|
4
|
+
// settings.activeModel: "aurora-1m", a `/model aurora-1m`, or any muscle memory keeps working — so the
|
|
5
|
+
// rename loses nothing. The served model name ("aurora-code-1") + endpoints stay internal, untouched.
|
|
6
|
+
export const MODEL_ALIASES = {
|
|
7
|
+
"aurora-1m": "operator-1m",
|
|
8
|
+
"aurora-128k": "operator-128k",
|
|
9
|
+
};
|
|
10
|
+
export const BUILTIN_MODELS = [
|
|
11
|
+
{ id: "operator-1m", label: "Operator 300K", kind: "single", desc: "307,200-token (300K) context (:8097)", endpoint: "http://127.0.0.1:8097/v1", model: "aurora-code-1", ctx: 307200 },
|
|
12
|
+
{ id: "operator-128k", label: "Operator 128K", kind: "single", desc: "128K context, lighter RAM (:8096)", endpoint: "http://127.0.0.1:8096/v1", model: "aurora-code-1", ctx: 131072 },
|
|
13
|
+
// QwenCloud Token Plan BYO connectors (SPEC/providers.md §2 "API-key connectors"). Same keychain
|
|
14
|
+
// account ("qwen") serves both; the picker hides them until connected (§1 honest availability), and
|
|
15
|
+
// authHeaders NEVER sends the Operator token to this host. ctx starts conservative and self-clamps
|
|
16
|
+
// to the served truth (observeContext).
|
|
17
|
+
{ id: "qwen3.8-max", label: "Qwen 3.8 Max", kind: "single", desc: "BYO QwenCloud Token Plan — credits from your plan", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-max", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
18
|
+
{ id: "qwen3.8-flash", label: "Qwen 3.8 Flash", kind: "single", desc: "BYO QwenCloud Token Plan — fast tier, your credits", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-flash", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
19
|
+
// Venice 24B — SELF-HOSTED like Aurora (NOT a third-party connector): the open uncensored weights
|
|
20
|
+
// (Dolphin-Mistral-24B-Venice-Edition Q4_K_M, JL1 Ai Storage) served via llama.cpp on JL1:8110, bound
|
|
21
|
+
// 0.0.0.0 so the engine (on JL2) reaches it over LAN. Uncensored at the weights — answers directly, no
|
|
22
|
+
// retry needed; complements the engine-level unrestricted layer. Runs ALONGSIDE Aurora (:8097); the
|
|
23
|
+
// llama.cpp router health-checks + recovers, and ctx self-clamps to the served truth (observeContext).
|
|
24
|
+
{ id: "venice-24b", label: "Venice 24B (uncensored)", kind: "single", desc: "self-hosted uncensored Dolphin-Mistral-24B-Venice (fleet llama.cpp, JL1:8110)", endpoint: "http://192.168.1.103:8110/v1", model: "dolphin-venice-24b", ctx: 8192 },
|
|
25
|
+
{ id: "moa", label: "MOA (Mixture of Agents)", kind: "orchestrated", desc: "fan out to proposers, synthesize with an aggregator" },
|
|
26
|
+
];
|
|
27
|
+
/** The runtime registry: the built-ins, with any settings.models entries merged in (overriding a
|
|
28
|
+
* built-in by id, or adding a new one) — same shape either way, so /model doesn't care which. */
|
|
29
|
+
export function modelRegistry(overrides) {
|
|
30
|
+
if (!overrides?.length)
|
|
31
|
+
return BUILTIN_MODELS;
|
|
32
|
+
const byId = new Map(BUILTIN_MODELS.map((m) => [m.id, m]));
|
|
33
|
+
for (const m of overrides)
|
|
34
|
+
byId.set(m.id, { ...byId.get(m.id), ...m });
|
|
35
|
+
return [...byId.values()];
|
|
36
|
+
}
|
|
37
|
+
export function findModel(registry, id) {
|
|
38
|
+
const canon = MODEL_ALIASES[id] ?? id; // aurora-1m -> operator-1m (old ids keep resolving)
|
|
39
|
+
return registry.find((m) => m.id === canon);
|
|
40
|
+
}
|
|
41
|
+
/** The configured context window (tokens) for a model id — from BUILTIN_MODELS + settings overrides — or
|
|
42
|
+
* Infinity if unknown. Used to pick a LEAN harness: a small-context model (e.g. a self-hosted 8K Venice)
|
|
43
|
+
* can't take Operator's full memory + handoff injection (sized for Aurora's 300K); it fills the window and
|
|
44
|
+
* the model recites the memory instead of answering. Callers drop the heavy memory/handoff below a
|
|
45
|
+
* threshold while keeping the base persona (incl. the Direct/unrestricted section), so it stays uncensored. */
|
|
46
|
+
export function modelCtxFor(id, overrides) {
|
|
47
|
+
if (!id)
|
|
48
|
+
return Number.POSITIVE_INFINITY;
|
|
49
|
+
return findModel(modelRegistry(overrides), id)?.ctx ?? Number.POSITIVE_INFINITY;
|
|
50
|
+
}
|
|
51
|
+
/** ctx window below which the lean harness (no heavy memory/handoff) kicks in. Aurora/Qwen (128K+) stay
|
|
52
|
+
* full; a self-hosted small model (Venice 8K, or a 16K bump) goes lean. */
|
|
53
|
+
export const LEAN_HARNESS_CTX = 32768;
|
|
54
|
+
/** Pure selection reducer for /model — no I/O (no settings read/write, no router mutation), so it's
|
|
55
|
+
* directly testable. The moa-needs-config check lives in Session.setModel (it needs settings.moa,
|
|
56
|
+
* which this module intentionally doesn't import). `hasByo` (injected by the caller, see auth/byo)
|
|
57
|
+
* gates BYO connector profiles: honest "not connected" beats a request-time 401. */
|
|
58
|
+
export function selectModel(registry, id, hasByo) {
|
|
59
|
+
const profile = findModel(registry, id);
|
|
60
|
+
if (!profile)
|
|
61
|
+
return { error: `unknown model "${id}" — choices: ${registry.map((m) => m.id).join(", ")}` };
|
|
62
|
+
if (profile.kind === "single" && !profile.endpoint)
|
|
63
|
+
return { error: `model "${id}" has no endpoint configured` };
|
|
64
|
+
if (profile.byo && hasByo && !hasByo(profile.byo)) {
|
|
65
|
+
return { error: `"${id}" is not connected — store the ${profile.byo} key first: operator auth byo ${profile.byo}` };
|
|
66
|
+
}
|
|
67
|
+
return { profile };
|
|
68
|
+
}
|
|
69
|
+
/** The picker-truth view of a registry: drops BYO profiles whose key isn't connected (and ALL
|
|
70
|
+
* unresolvable ones when the resolver is absent — a picker must never offer what setModel refuses). */
|
|
71
|
+
export function visibleModels(registry, hasByo) {
|
|
72
|
+
return registry.filter((p) => !p.byo || (hasByo ? hasByo(p.byo) : false));
|
|
73
|
+
}
|
|
74
|
+
/** Strip a trailing /v1 so a ModelProfile/MoaAggregator endpoint can feed the AuroraRouter, whose
|
|
75
|
+
* base is bare (engine/aurora.ts's chat() appends /v1/chat/completions itself). */
|
|
76
|
+
export function endpointBase(endpoint) {
|
|
77
|
+
return endpoint.replace(/\/v1\/?$/, "");
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const DEFAULT_MODEL_ID = "operator-1m";
|
|
2
|
+
// Back-compat aliases: the user-facing ids were renamed aurora-* -> operator-* (the outward name is
|
|
3
|
+
// Operator; "aurora" is the internal model, never shown). The OLD ids still resolve — a persisted
|
|
4
|
+
// settings.activeModel: "aurora-1m", a `/model aurora-1m`, or any muscle memory keeps working — so the
|
|
5
|
+
// rename loses nothing. The served model name ("aurora-code-1") + endpoints stay internal, untouched.
|
|
6
|
+
export const MODEL_ALIASES = {
|
|
7
|
+
"aurora-1m": "operator-1m",
|
|
8
|
+
"aurora-128k": "operator-128k",
|
|
9
|
+
};
|
|
10
|
+
export const BUILTIN_MODELS = [
|
|
11
|
+
{ id: "operator-1m", label: "Operator 300K", kind: "single", desc: "307,200-token (300K) context (:8097)", endpoint: "http://127.0.0.1:8097/v1", model: "aurora-code-1", ctx: 307200 },
|
|
12
|
+
{ id: "operator-128k", label: "Operator 128K", kind: "single", desc: "128K context, lighter RAM (:8096)", endpoint: "http://127.0.0.1:8096/v1", model: "aurora-code-1", ctx: 131072 },
|
|
13
|
+
// QwenCloud Token Plan BYO connectors (SPEC/providers.md §2 "API-key connectors"). Same keychain
|
|
14
|
+
// account ("qwen") serves both; the picker hides them until connected (§1 honest availability), and
|
|
15
|
+
// authHeaders NEVER sends the Operator token to this host. ctx starts conservative and self-clamps
|
|
16
|
+
// to the served truth (observeContext).
|
|
17
|
+
{ id: "qwen3.8-max", label: "Qwen 3.8 Max", kind: "single", desc: "BYO QwenCloud Token Plan — credits from your plan", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-max", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
18
|
+
{ id: "qwen3.8-flash", label: "Qwen 3.8 Flash", kind: "single", desc: "BYO QwenCloud Token Plan — fast tier, your credits", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-flash", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
19
|
+
// Venice 24B — SELF-HOSTED like Aurora (NOT a third-party connector): the open uncensored weights
|
|
20
|
+
// (Dolphin-Mistral-24B-Venice-Edition Q4_K_M, JL1 Ai Storage) served via llama.cpp on JL1:8110, bound
|
|
21
|
+
// 0.0.0.0 so the engine (on JL2) reaches it over LAN. Uncensored at the weights — answers directly, no
|
|
22
|
+
// retry needed; complements the engine-level unrestricted layer. Runs ALONGSIDE Aurora (:8097); the
|
|
23
|
+
// llama.cpp router health-checks + recovers, and ctx self-clamps to the served truth (observeContext).
|
|
24
|
+
{ id: "venice-24b", label: "Venice 24B (uncensored)", kind: "single", desc: "self-hosted uncensored Dolphin-Mistral-24B-Venice (fleet llama.cpp, JL1:8110)", endpoint: "http://192.168.1.103:8110/v1", model: "dolphin-venice-24b", ctx: 8192 },
|
|
25
|
+
{ id: "moa", label: "MOA (Mixture of Agents)", kind: "orchestrated", desc: "fan out to proposers, synthesize with an aggregator" },
|
|
26
|
+
];
|
|
27
|
+
/** The runtime registry: the built-ins, with any settings.models entries merged in (overriding a
|
|
28
|
+
* built-in by id, or adding a new one) — same shape either way, so /model doesn't care which. */
|
|
29
|
+
export function modelRegistry(overrides) {
|
|
30
|
+
if (!overrides?.length)
|
|
31
|
+
return BUILTIN_MODELS;
|
|
32
|
+
const byId = new Map(BUILTIN_MODELS.map((m) => [m.id, m]));
|
|
33
|
+
for (const m of overrides)
|
|
34
|
+
byId.set(m.id, { ...byId.get(m.id), ...m });
|
|
35
|
+
return [...byId.values()];
|
|
36
|
+
}
|
|
37
|
+
export function findModel(registry, id) {
|
|
38
|
+
const canon = MODEL_ALIASES[id] ?? id; // aurora-1m -> operator-1m (old ids keep resolving)
|
|
39
|
+
return registry.find((m) => m.id === canon);
|
|
40
|
+
}
|
|
41
|
+
/** The configured context window (tokens) for a model id — from BUILTIN_MODELS + settings overrides — or
|
|
42
|
+
* Infinity if unknown. Used to pick a LEAN harness: a small-context model (e.g. a self-hosted 8K Venice)
|
|
43
|
+
* can't take Operator's full memory + handoff injection (sized for Aurora's 300K); it fills the window and
|
|
44
|
+
* the model recites the memory instead of answering. Callers drop the heavy memory/handoff below a
|
|
45
|
+
* threshold while keeping the base persona (incl. the Direct/unrestricted section), so it stays uncensored. */
|
|
46
|
+
export function modelCtxFor(id, overrides) {
|
|
47
|
+
if (!id)
|
|
48
|
+
return Number.POSITIVE_INFINITY;
|
|
49
|
+
return findModel(modelRegistry(overrides), id)?.ctx ?? Number.POSITIVE_INFINITY;
|
|
50
|
+
}
|
|
51
|
+
/** ctx window below which the lean harness (no heavy memory/handoff) kicks in. Aurora/Qwen (128K+) stay
|
|
52
|
+
* full; a self-hosted small model (Venice 8K, or a 16K bump) goes lean. */
|
|
53
|
+
export const LEAN_HARNESS_CTX = 32768;
|
|
54
|
+
/** Pure selection reducer for /model — no I/O (no settings read/write, no router mutation), so it's
|
|
55
|
+
* directly testable. The moa-needs-config check lives in Session.setModel (it needs settings.moa,
|
|
56
|
+
* which this module intentionally doesn't import). `hasByo` (injected by the caller, see auth/byo)
|
|
57
|
+
* gates BYO connector profiles: honest "not connected" beats a request-time 401. */
|
|
58
|
+
export function selectModel(registry, id, hasByo) {
|
|
59
|
+
const profile = findModel(registry, id);
|
|
60
|
+
if (!profile)
|
|
61
|
+
return { error: `unknown model "${id}" — choices: ${registry.map((m) => m.id).join(", ")}` };
|
|
62
|
+
if (profile.kind === "single" && !profile.endpoint)
|
|
63
|
+
return { error: `model "${id}" has no endpoint configured` };
|
|
64
|
+
if (profile.byo && hasByo && !hasByo(profile.byo)) {
|
|
65
|
+
return { error: `"${id}" is not connected — store the ${profile.byo} key first: operator auth byo ${profile.byo}` };
|
|
66
|
+
}
|
|
67
|
+
return { profile };
|
|
68
|
+
}
|
|
69
|
+
/** The picker-truth view of a registry: drops BYO profiles whose key isn't connected (and ALL
|
|
70
|
+
* unresolvable ones when the resolver is absent — a picker must never offer what setModel refuses). */
|
|
71
|
+
export function visibleModels(registry, hasByo) {
|
|
72
|
+
return registry.filter((p) => !p.byo || (hasByo ? hasByo(p.byo) : false));
|
|
73
|
+
}
|
|
74
|
+
/** Strip a trailing /v1 so a ModelProfile/MoaAggregator endpoint can feed the AuroraRouter, whose
|
|
75
|
+
* base is bare (engine/aurora.ts's chat() appends /v1/chat/completions itself). */
|
|
76
|
+
export function endpointBase(endpoint) {
|
|
77
|
+
return endpoint.replace(/\/v1\/?$/, "");
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const DEFAULT_MODEL_ID = "operator-1m";
|
|
2
|
+
// Back-compat aliases: the user-facing ids were renamed aurora-* -> operator-* (the outward name is
|
|
3
|
+
// Operator; "aurora" is the internal model, never shown). The OLD ids still resolve — a persisted
|
|
4
|
+
// settings.activeModel: "aurora-1m", a `/model aurora-1m`, or any muscle memory keeps working — so the
|
|
5
|
+
// rename loses nothing. The served model name ("aurora-code-1") + endpoints stay internal, untouched.
|
|
6
|
+
export const MODEL_ALIASES = {
|
|
7
|
+
"aurora-1m": "operator-1m",
|
|
8
|
+
"aurora-128k": "operator-128k",
|
|
9
|
+
};
|
|
10
|
+
export const BUILTIN_MODELS = [
|
|
11
|
+
{ id: "operator-1m", label: "Operator 300K", kind: "single", desc: "307,200-token (300K) context (:8097)", endpoint: "http://127.0.0.1:8097/v1", model: "aurora-code-1", ctx: 307200 },
|
|
12
|
+
{ id: "operator-128k", label: "Operator 128K", kind: "single", desc: "128K context, lighter RAM (:8096)", endpoint: "http://127.0.0.1:8096/v1", model: "aurora-code-1", ctx: 131072 },
|
|
13
|
+
// QwenCloud Token Plan BYO connectors (SPEC/providers.md §2 "API-key connectors"). Same keychain
|
|
14
|
+
// account ("qwen") serves both; the picker hides them until connected (§1 honest availability), and
|
|
15
|
+
// authHeaders NEVER sends the Operator token to this host. ctx starts conservative and self-clamps
|
|
16
|
+
// to the served truth (observeContext).
|
|
17
|
+
{ id: "qwen3.8-max", label: "Qwen 3.8 Max", kind: "single", desc: "BYO QwenCloud Token Plan — credits from your plan", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-max", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
18
|
+
{ id: "qwen3.8-flash", label: "Qwen 3.8 Flash", kind: "single", desc: "BYO QwenCloud Token Plan — fast tier, your credits", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-flash", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
19
|
+
// Venice 24B — SELF-HOSTED like Aurora (NOT a third-party connector): the open uncensored weights
|
|
20
|
+
// (Dolphin-Mistral-24B-Venice-Edition Q4_K_M, JL1 Ai Storage) served via llama.cpp on JL1:8110, bound
|
|
21
|
+
// 0.0.0.0 so the engine (on JL2) reaches it over LAN. Uncensored at the weights — answers directly, no
|
|
22
|
+
// retry needed; complements the engine-level unrestricted layer. Runs ALONGSIDE Aurora (:8097); the
|
|
23
|
+
// llama.cpp router health-checks + recovers, and ctx self-clamps to the served truth (observeContext).
|
|
24
|
+
{ id: "venice-24b", label: "Venice 24B (uncensored)", kind: "single", desc: "self-hosted uncensored Dolphin-Mistral-24B-Venice (fleet llama.cpp, JL1:8110)", endpoint: "http://192.168.1.103:8110/v1", model: "dolphin-venice-24b", ctx: 8192 },
|
|
25
|
+
{ id: "moa", label: "MOA (Mixture of Agents)", kind: "orchestrated", desc: "fan out to proposers, synthesize with an aggregator" },
|
|
26
|
+
];
|
|
27
|
+
/** The runtime registry: the built-ins, with any settings.models entries merged in (overriding a
|
|
28
|
+
* built-in by id, or adding a new one) — same shape either way, so /model doesn't care which. */
|
|
29
|
+
export function modelRegistry(overrides) {
|
|
30
|
+
if (!overrides?.length)
|
|
31
|
+
return BUILTIN_MODELS;
|
|
32
|
+
const byId = new Map(BUILTIN_MODELS.map((m) => [m.id, m]));
|
|
33
|
+
for (const m of overrides)
|
|
34
|
+
byId.set(m.id, { ...byId.get(m.id), ...m });
|
|
35
|
+
return [...byId.values()];
|
|
36
|
+
}
|
|
37
|
+
export function findModel(registry, id) {
|
|
38
|
+
const canon = MODEL_ALIASES[id] ?? id; // aurora-1m -> operator-1m (old ids keep resolving)
|
|
39
|
+
return registry.find((m) => m.id === canon);
|
|
40
|
+
}
|
|
41
|
+
/** The configured context window (tokens) for a model id — from BUILTIN_MODELS + settings overrides — or
|
|
42
|
+
* Infinity if unknown. Used to pick a LEAN harness: a small-context model (e.g. a self-hosted 8K Venice)
|
|
43
|
+
* can't take Operator's full memory + handoff injection (sized for Aurora's 300K); it fills the window and
|
|
44
|
+
* the model recites the memory instead of answering. Callers drop the heavy memory/handoff below a
|
|
45
|
+
* threshold while keeping the base persona (incl. the Direct/unrestricted section), so it stays uncensored. */
|
|
46
|
+
export function modelCtxFor(id, overrides) {
|
|
47
|
+
if (!id)
|
|
48
|
+
return Number.POSITIVE_INFINITY;
|
|
49
|
+
return findModel(modelRegistry(overrides), id)?.ctx ?? Number.POSITIVE_INFINITY;
|
|
50
|
+
}
|
|
51
|
+
/** ctx window below which the lean harness (no heavy memory/handoff) kicks in. Aurora/Qwen (128K+) stay
|
|
52
|
+
* full; a self-hosted small model (Venice 8K, or a 16K bump) goes lean. */
|
|
53
|
+
export const LEAN_HARNESS_CTX = 32768;
|
|
54
|
+
/** Pure selection reducer for /model — no I/O (no settings read/write, no router mutation), so it's
|
|
55
|
+
* directly testable. The moa-needs-config check lives in Session.setModel (it needs settings.moa,
|
|
56
|
+
* which this module intentionally doesn't import). `hasByo` (injected by the caller, see auth/byo)
|
|
57
|
+
* gates BYO connector profiles: honest "not connected" beats a request-time 401. */
|
|
58
|
+
export function selectModel(registry, id, hasByo) {
|
|
59
|
+
const profile = findModel(registry, id);
|
|
60
|
+
if (!profile)
|
|
61
|
+
return { error: `unknown model "${id}" — choices: ${registry.map((m) => m.id).join(", ")}` };
|
|
62
|
+
if (profile.kind === "single" && !profile.endpoint)
|
|
63
|
+
return { error: `model "${id}" has no endpoint configured` };
|
|
64
|
+
if (profile.byo && hasByo && !hasByo(profile.byo)) {
|
|
65
|
+
return { error: `"${id}" is not connected — store the ${profile.byo} key first: operator auth byo ${profile.byo}` };
|
|
66
|
+
}
|
|
67
|
+
return { profile };
|
|
68
|
+
}
|
|
69
|
+
/** The picker-truth view of a registry: drops BYO profiles whose key isn't connected (and ALL
|
|
70
|
+
* unresolvable ones when the resolver is absent — a picker must never offer what setModel refuses). */
|
|
71
|
+
export function visibleModels(registry, hasByo) {
|
|
72
|
+
return registry.filter((p) => !p.byo || (hasByo ? hasByo(p.byo) : false));
|
|
73
|
+
}
|
|
74
|
+
/** Strip a trailing /v1 so a ModelProfile/MoaAggregator endpoint can feed the AuroraRouter, whose
|
|
75
|
+
* base is bare (engine/aurora.ts's chat() appends /v1/chat/completions itself). */
|
|
76
|
+
export function endpointBase(endpoint) {
|
|
77
|
+
return endpoint.replace(/\/v1\/?$/, "");
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const DEFAULT_MODEL_ID = "operator-1m";
|
|
2
|
+
// Back-compat aliases: the user-facing ids were renamed aurora-* -> operator-* (the outward name is
|
|
3
|
+
// Operator; "aurora" is the internal model, never shown). The OLD ids still resolve — a persisted
|
|
4
|
+
// settings.activeModel: "aurora-1m", a `/model aurora-1m`, or any muscle memory keeps working — so the
|
|
5
|
+
// rename loses nothing. The served model name ("aurora-code-1") + endpoints stay internal, untouched.
|
|
6
|
+
export const MODEL_ALIASES = {
|
|
7
|
+
"aurora-1m": "operator-1m",
|
|
8
|
+
"aurora-128k": "operator-128k",
|
|
9
|
+
};
|
|
10
|
+
export const BUILTIN_MODELS = [
|
|
11
|
+
{ id: "operator-1m", label: "Operator 300K", kind: "single", desc: "307,200-token (300K) context (:8097)", endpoint: "http://127.0.0.1:8097/v1", model: "aurora-code-1", ctx: 307200 },
|
|
12
|
+
{ id: "operator-128k", label: "Operator 128K", kind: "single", desc: "128K context, lighter RAM (:8096)", endpoint: "http://127.0.0.1:8096/v1", model: "aurora-code-1", ctx: 131072 },
|
|
13
|
+
// QwenCloud Token Plan BYO connectors (SPEC/providers.md §2 "API-key connectors"). Same keychain
|
|
14
|
+
// account ("qwen") serves both; the picker hides them until connected (§1 honest availability), and
|
|
15
|
+
// authHeaders NEVER sends the Operator token to this host. ctx starts conservative and self-clamps
|
|
16
|
+
// to the served truth (observeContext).
|
|
17
|
+
{ id: "qwen3.8-max", label: "Qwen 3.8 Max", kind: "single", desc: "BYO QwenCloud Token Plan — credits from your plan", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-max", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
18
|
+
{ id: "qwen3.8-flash", label: "Qwen 3.8 Flash", kind: "single", desc: "BYO QwenCloud Token Plan — fast tier, your credits", endpoint: "https://token-plan.maas.qwencloudapi.com/compatible-mode/v1", model: "qwen3.8-flash", ctx: 262144, byo: "qwen", transport: "openai" },
|
|
19
|
+
// Venice 24B — SELF-HOSTED like Aurora (NOT a third-party connector): the open uncensored weights
|
|
20
|
+
// (Dolphin-Mistral-24B-Venice-Edition Q4_K_M, JL1 Ai Storage) served via llama.cpp on JL1:8110, bound
|
|
21
|
+
// 0.0.0.0 so the engine (on JL2) reaches it over LAN. Uncensored at the weights — answers directly, no
|
|
22
|
+
// retry needed; complements the engine-level unrestricted layer. Runs ALONGSIDE Aurora (:8097); the
|
|
23
|
+
// llama.cpp router health-checks + recovers, and ctx self-clamps to the served truth (observeContext).
|
|
24
|
+
{ id: "venice-24b", label: "Venice 24B (uncensored)", kind: "single", desc: "self-hosted uncensored Dolphin-Mistral-24B-Venice (fleet llama.cpp, JL1:8110)", endpoint: "http://192.168.1.103:8110/v1", model: "dolphin-venice-24b", ctx: 8192 },
|
|
25
|
+
{ id: "moa", label: "MOA (Mixture of Agents)", kind: "orchestrated", desc: "fan out to proposers, synthesize with an aggregator" },
|
|
26
|
+
];
|
|
27
|
+
/** The runtime registry: the built-ins, with any settings.models entries merged in (overriding a
|
|
28
|
+
* built-in by id, or adding a new one) — same shape either way, so /model doesn't care which. */
|
|
29
|
+
export function modelRegistry(overrides) {
|
|
30
|
+
if (!overrides?.length)
|
|
31
|
+
return BUILTIN_MODELS;
|
|
32
|
+
const byId = new Map(BUILTIN_MODELS.map((m) => [m.id, m]));
|
|
33
|
+
for (const m of overrides)
|
|
34
|
+
byId.set(m.id, { ...byId.get(m.id), ...m });
|
|
35
|
+
return [...byId.values()];
|
|
36
|
+
}
|
|
37
|
+
export function findModel(registry, id) {
|
|
38
|
+
const canon = MODEL_ALIASES[id] ?? id; // aurora-1m -> operator-1m (old ids keep resolving)
|
|
39
|
+
return registry.find((m) => m.id === canon);
|
|
40
|
+
}
|
|
41
|
+
/** The configured context window (tokens) for a model id — from BUILTIN_MODELS + settings overrides — or
|
|
42
|
+
* Infinity if unknown. Used to pick a LEAN harness: a small-context model (e.g. a self-hosted 8K Venice)
|
|
43
|
+
* can't take Operator's full memory + handoff injection (sized for Aurora's 300K); it fills the window and
|
|
44
|
+
* the model recites the memory instead of answering. Callers drop the heavy memory/handoff below a
|
|
45
|
+
* threshold while keeping the base persona (incl. the Direct/unrestricted section), so it stays uncensored. */
|
|
46
|
+
export function modelCtxFor(id, overrides) {
|
|
47
|
+
if (!id)
|
|
48
|
+
return Number.POSITIVE_INFINITY;
|
|
49
|
+
return findModel(modelRegistry(overrides), id)?.ctx ?? Number.POSITIVE_INFINITY;
|
|
50
|
+
}
|
|
51
|
+
/** ctx window below which the lean harness (no heavy memory/handoff) kicks in. Aurora/Qwen (128K+) stay
|
|
52
|
+
* full; a self-hosted small model (Venice 8K, or a 16K bump) goes lean. */
|
|
53
|
+
export const LEAN_HARNESS_CTX = 32768;
|
|
54
|
+
/** Pure selection reducer for /model — no I/O (no settings read/write, no router mutation), so it's
|
|
55
|
+
* directly testable. The moa-needs-config check lives in Session.setModel (it needs settings.moa,
|
|
56
|
+
* which this module intentionally doesn't import). `hasByo` (injected by the caller, see auth/byo)
|
|
57
|
+
* gates BYO connector profiles: honest "not connected" beats a request-time 401. */
|
|
58
|
+
export function selectModel(registry, id, hasByo) {
|
|
59
|
+
const profile = findModel(registry, id);
|
|
60
|
+
if (!profile)
|
|
61
|
+
return { error: `unknown model "${id}" — choices: ${registry.map((m) => m.id).join(", ")}` };
|
|
62
|
+
if (profile.kind === "single" && !profile.endpoint)
|
|
63
|
+
return { error: `model "${id}" has no endpoint configured` };
|
|
64
|
+
if (profile.byo && hasByo && !hasByo(profile.byo)) {
|
|
65
|
+
return { error: `"${id}" is not connected — store the ${profile.byo} key first: operator auth byo ${profile.byo}` };
|
|
66
|
+
}
|
|
67
|
+
return { profile };
|
|
68
|
+
}
|
|
69
|
+
/** The picker-truth view of a registry: drops BYO profiles whose key isn't connected (and ALL
|
|
70
|
+
* unresolvable ones when the resolver is absent — a picker must never offer what setModel refuses). */
|
|
71
|
+
export function visibleModels(registry, hasByo) {
|
|
72
|
+
return registry.filter((p) => !p.byo || (hasByo ? hasByo(p.byo) : false));
|
|
73
|
+
}
|
|
74
|
+
/** Strip a trailing /v1 so a ModelProfile/MoaAggregator endpoint can feed the AuroraRouter, whose
|
|
75
|
+
* base is bare (engine/aurora.ts's chat() appends /v1/chat/completions itself). */
|
|
76
|
+
export function endpointBase(endpoint) {
|
|
77
|
+
return endpoint.replace(/\/v1\/?$/, "");
|
|
78
|
+
}
|