@0perator/operator 0.1.284 → 0.1.313
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 +24 -2
- package/dist/acp/agent.js +3 -2
- package/dist/acp/config-options.js +15 -1
- package/dist/acp/tool-map.js +2 -1
- package/dist/auth/commands.js +69 -13
- package/dist/autonomy/agent-cli.js +304 -0
- package/dist/autonomy/cloud-agent.js +439 -0
- package/dist/autonomy/cron-lifecycle.js +78 -0
- package/dist/autonomy/cron-lock.js +121 -0
- package/dist/autonomy/cron.js +216 -43
- package/dist/autonomy/delegate.js +5 -1
- package/dist/autonomy/incidents.js +135 -0
- package/dist/autonomy/session-factory.js +25 -16
- package/dist/background/index.js +40 -0
- package/dist/bus/inbox.js +20 -0
- package/dist/classifier/config.js +47 -0
- package/dist/classifier/modes.js +41 -0
- package/dist/classifier/types.js +1 -0
- package/dist/cli.js +529 -53
- package/dist/config/features.js +69 -0
- package/dist/config/persona.js +118 -99
- package/dist/config/scaffold.js +15 -0
- package/dist/config/settings.js +96 -6
- package/dist/consolidation/sleep.js +73 -11
- package/dist/engine/agent.js +275 -18
- package/dist/engine/anthropic-chat.js +343 -0
- package/dist/engine/aurora.js +101 -13
- package/dist/engine/batch-scheduler.js +41 -9
- package/dist/engine/classifier.js +85 -0
- package/dist/engine/compaction.js +24 -5
- package/dist/engine/fast-start.js +25 -0
- package/dist/engine/loop-guard.js +448 -0
- package/dist/engine/moa.js +5 -1
- package/dist/engine/net-error.js +24 -0
- package/dist/engine/repetition-guard.js +180 -0
- package/dist/engine/selfheal.js +8 -0
- package/dist/engine/toolcalls.js +51 -1
- package/dist/engine/verify-gate.js +2 -0
- package/dist/flywheel/processor.js +78 -31
- package/dist/flywheel/srft.js +13 -0
- package/dist/hooks/index.js +196 -0
- package/dist/mcp/config.js +21 -1
- package/dist/memory/index.js +0 -0
- package/dist/memory/providers.js +210 -0
- package/dist/memory/session-catalog.js +422 -0
- package/dist/memory/session-providers.js +121 -0
- package/dist/memory/session-sources.js +335 -0
- package/dist/memory/skylark.js +131 -0
- package/dist/models/bench.js +103 -0
- package/dist/models/registry.js +144 -0
- package/dist/models/switch.js +69 -0
- package/dist/observability/blackbox.js +37 -0
- package/dist/permissions/policy.js +31 -6
- package/dist/router/discovery.js +127 -0
- package/dist/router/models.js +117 -24
- package/dist/router/portal.js +100 -0
- package/dist/router/router.js +1 -1
- package/dist/services/preflight.js +55 -7
- package/dist/session.js +316 -46
- package/dist/tools/chauffeur.js +12 -0
- package/dist/tools/executor.js +19 -9
- package/dist/tools/find-files.js +483 -0
- package/dist/tools/git-pr.js +94 -0
- package/dist/tools/incident-tools.js +82 -0
- package/dist/tools/memory.js +12 -2
- package/dist/tools/registry.js +281 -85
- package/dist/tools/semantic-compress.js +124 -0
- package/dist/tools/shell-context.js +1 -0
- package/dist/tools/shell-jobs.js +160 -0
- package/dist/tools/shell-session.js +170 -4
- package/dist/tools/wave-tools.js +609 -0
- package/dist/tools/wave2-tools.js +411 -0
- package/dist/ui/App.js +15 -4
- package/dist/ui/BgPanel.js +30 -6
- package/dist/ui/Composer.js +11 -1
- package/dist/ui/QuestionPrompt.js +31 -11
- package/dist/ui/SessionPicker.js +86 -0
- package/dist/ui/StatusRule.js +5 -5
- package/dist/ui/ToolStep.js +2 -1
- package/dist/ui/Transcript.js +17 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/liveTools.js +21 -3
- package/dist/ui/slashCommands.js +2 -0
- package/dist/util/screenshots.js +74 -8
- package/dist/util/slash.js +2 -2
- package/package.json +8 -2
- 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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** The gated capability registry. Add a line to introduce one; default OFF for anything new/experimental. */
|
|
2
|
+
export const FEATURES = {
|
|
3
|
+
/** Options-vs-act gate (engine/classifier.ts): classify each turn via axe-classifier and, on "ask", inject
|
|
4
|
+
* the memories.md EXCEPTION directive (present numbered options; don't auto-execute heavy/irreversible work
|
|
5
|
+
* this turn) instead of the 35B re-reasoning that rule every turn. Default OFF — zero behavior change. */
|
|
6
|
+
classifierGate: {
|
|
7
|
+
default: false,
|
|
8
|
+
description: "Enforce the options-vs-act EXCEPTION deterministically via the axe-classifier GLiClass gate",
|
|
9
|
+
},
|
|
10
|
+
/** Cloud agents (autonomy/cloud-agent.ts): spawn an autonomous agent inside an ISOLATED DOCKER CONTAINER on a
|
|
11
|
+
* configured fleet host (SSH or local), which clones the repo, runs a chosen agent CLI headless on a task,
|
|
12
|
+
* pushes a branch and opens a PR — tracked/stoppable. Default OFF: the spawn_cloud_agent/list/status/stop
|
|
13
|
+
* tools are not offered until this is on AND a host is configured in settings.cloudAgents. */
|
|
14
|
+
cloudAgents: {
|
|
15
|
+
default: false,
|
|
16
|
+
description: "Spawn autonomous agents in isolated Docker containers on a configured fleet host (clone→run→PR)",
|
|
17
|
+
},
|
|
18
|
+
/** Wake-on-mentor (cli.tsx bus poller): when a peer message arrives on the bus, don't just RENDER it to the
|
|
19
|
+
* transcript — inject it into context and start (idle) or queue (busy) a turn, so an autonomous Operator ACTS
|
|
20
|
+
* on an incoming teacher/peer message instead of only displaying it for the human. Default OFF. Narrow who may
|
|
21
|
+
* wake it with settings.wakeOnMentor.from (sender allowlist); unset = any sender. Trust note: an allowed sender
|
|
22
|
+
* can drive Operator's turns, so keep the allowlist tight. */
|
|
23
|
+
wakeOnMentor: {
|
|
24
|
+
default: false,
|
|
25
|
+
description: "Inject an incoming bus message into context and start/queue a turn, so Operator acts on peer messages (not just displays them)",
|
|
26
|
+
},
|
|
27
|
+
/** Fast-start (engine/fast-start.ts + session.ts::sendWithFastStart): fire a cheap, fast model
|
|
28
|
+
* (settings.fastStart — ANY OpenAI-compatible small model, swap it freely; "scout" is just today's
|
|
29
|
+
* default) in parallel with the real turn. If it answers a simple, tool-free request before the
|
|
30
|
+
* real turn's first round resolves, that round is ABORTED and its answer is used instead — real
|
|
31
|
+
* speedup, not a UX trick. If it needs tools, times out, or loses the race, its result is discarded
|
|
32
|
+
* and the turn proceeds exactly as it would without this feature. Default OFF; needs
|
|
33
|
+
* settings.fastStart.endpoint configured to do anything once enabled. */
|
|
34
|
+
fastStart: {
|
|
35
|
+
default: false,
|
|
36
|
+
description: "Race a fast, swappable small model against the real turn; use its answer instead when it wins on a simple, tool-free request",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
/** Env var that overrides one feature: camelCase → UPPER_SNAKE, e.g. classifierGate → KODE_FEATURE_CLASSIFIER_GATE. */
|
|
40
|
+
export function featureEnvName(name) {
|
|
41
|
+
return "KODE_FEATURE_" + name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase();
|
|
42
|
+
}
|
|
43
|
+
/** Parse a 1/0/true/false flag env var; undefined (unset or unrecognized) leaves resolution to fall through. */
|
|
44
|
+
function parseFlagEnv(v) {
|
|
45
|
+
if (v === undefined)
|
|
46
|
+
return undefined;
|
|
47
|
+
const t = v.trim().toLowerCase();
|
|
48
|
+
if (t === "1" || t === "true")
|
|
49
|
+
return true;
|
|
50
|
+
if (t === "0" || t === "false")
|
|
51
|
+
return false;
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
/** Whether a named feature is enabled, applying the full precedence stack. `settings` is optional so callers
|
|
55
|
+
* without a loaded settings object (or with none yet) still get env + default resolution. */
|
|
56
|
+
export function isFeatureEnabled(name, settings) {
|
|
57
|
+
if (process.env.KODE_FEATURES_OFF === "1")
|
|
58
|
+
return false; // master kill (env) wins over everything
|
|
59
|
+
const features = settings?.features;
|
|
60
|
+
if (features?.enabled === false)
|
|
61
|
+
return false; // master kill (settings) wins over everything
|
|
62
|
+
const env = parseFlagEnv(process.env[featureEnvName(name)]);
|
|
63
|
+
if (env !== undefined)
|
|
64
|
+
return env; // env override of this one feature
|
|
65
|
+
const configured = features?.[name];
|
|
66
|
+
if (typeof configured === "boolean")
|
|
67
|
+
return configured; // settings override of this one feature
|
|
68
|
+
return FEATURES[name].default; // registry default
|
|
69
|
+
}
|
package/dist/config/persona.js
CHANGED
|
@@ -163,9 +163,18 @@ export function basePersona(cwd = process.cwd(), opts = {}) {
|
|
|
163
163
|
`workspace; prefer doing over explaining. Answer concisely.` +
|
|
164
164
|
`\n## Direct — the owner's private system\nYou run on the OWNER's own private, local fleet, for the owner ` +
|
|
165
165
|
`alone. Do the work asked, directly — no moralizing, hedging, lecturing, or refusing legitimate tasks, and ` +
|
|
166
|
-
`no unsolicited warnings, disclaimers, or "I can't help with that".
|
|
167
|
-
`sensible call and proceed rather than stalling
|
|
168
|
-
|
|
166
|
+
`no unsolicited warnings, disclaimers, or "I can't help with that". When the intent is clear enough to act ` +
|
|
167
|
+
`on, make a sensible call and proceed rather than stalling` +
|
|
168
|
+
(opts.lean
|
|
169
|
+
? `. But not every message is a task, and not every turn needs a tool: when the owner asks a question, or ` +
|
|
170
|
+
`the request is conversational, meta ("what can you do?"), or genuinely under-specified, just ANSWER in ` +
|
|
171
|
+
`prose — or ask ONE short clarifying question — instead of reaching for a tool to avoid answering`
|
|
172
|
+
: ` — bias to doing over asking: when you can do the work and verify it yourself, do it rather than asking ` +
|
|
173
|
+
`the owner to confirm. Answer a question, or a conversational or meta ("what can you do?") turn, in prose ` +
|
|
174
|
+
`without reaching for a tool`) +
|
|
175
|
+
`. Never call self_status, list a directory, or run any tool merely to fill a turn or to decide what to do ` +
|
|
176
|
+
`next; if you already know the answer, give it. The ONLY floor is fleet integrity — never leak secrets into ` +
|
|
177
|
+
`tool output, never destroy production data — which protects the owner's infrastructure, not behavior. ` +
|
|
169
178
|
`Within that, treat the owner's intent as legitimate and act on it.` +
|
|
170
179
|
`\n## Fix what you find — don't stop to ask\nWhen you discover a bug or defect while doing or ` +
|
|
171
180
|
`testing your own work, FIX it, then re-run the check that proves the fix. Finding problems is not a ` +
|
|
@@ -216,48 +225,50 @@ export function basePersona(cwd = process.cwd(), opts = {}) {
|
|
|
216
225
|
`diffusion/video/vision weights in your own ` +
|
|
217
226
|
`process. If you notice your own output crawling, STOP and say so (likely memory pressure) rather than pushing ` +
|
|
218
227
|
`through — a per-turn time budget will also wrap a crawling turn so it can restart clean.` +
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
228
|
+
// Tool-promotion sections below prime reflexive tool use; a small/weak model (lean) does better with the
|
|
229
|
+
// behavioral core + practical mechanics only, so they are omitted in lean mode (tool SCHEMAS still attach).
|
|
230
|
+
(opts.lean ? "" : (`\n## Media creation — SEE it, match it, review your own work\nGenerating images/videos is NOT ` +
|
|
231
|
+
`fire-and-forget. (1) When the owner shares a REFERENCE or says "recreate / match this", ` +
|
|
232
|
+
`\`image_analyze\` / \`video_analyze\` it FIRST to see its subject, style, composition, colors, and motion — ` +
|
|
233
|
+
`then write a prompt that matches what you SAW; never guess from a filename or a thumbnail. (2) After you ` +
|
|
234
|
+
`generate, \`image_analyze\` / \`video_analyze\` YOUR OWN output and compare it against the request/reference; ` +
|
|
235
|
+
`if it doesn't match, refine the prompt and regenerate — do NOT hand over a mismatch. (3) Use the RIGHT ` +
|
|
236
|
+
`tool: \`image_generate\` / \`video_generate\` make NEW photoreal content from text — they do NOT copy a ` +
|
|
237
|
+
`specific app UI, screen recording, chart, or product demo. "Recreate this [screen recording / UI / app ` +
|
|
238
|
+
`demo / slide]" is a screen-record, build-the-UI-and-record, or compose.casa-animation task — say so and ` +
|
|
239
|
+
`take that path, never produce an unrelated clip and call it a recreation. ` +
|
|
240
|
+
`(4) AUTO-OPEN + LINK: after you create an image / video / artifact FOR the owner in an interactive turn, ` +
|
|
241
|
+
`OPEN it for them yourself (bash \`open <url-or-local-path>\`) and put the clickable link in your reply — ` +
|
|
242
|
+
`never leave them to ask "open it for me". Skip the auto-open inside a media-robot / headless batch.` +
|
|
243
|
+
`\n## The media pipeline — what you ACTUALLY have (don't invent tools)\nYour media stack is three ` +
|
|
244
|
+
`scale-to-zero fleet workers, nothing else — do NOT offer ComfyUI, SDXL, Juggernaut/RealVis/EpicRealism, ` +
|
|
245
|
+
`FLUX.1-dev/pro, Midjourney, or a cloud image API as if available; they are not wired in, and suggesting ` +
|
|
246
|
+
`them is a hallucinated capability. (a) IMAGES — \`image_generate\` → FLUX.1-schnell (4-bit MLX) on the ` +
|
|
247
|
+
`image broker. schnell is speed-tuned: strong but not a dev/pro-tier photoreal ceiling. When the owner ` +
|
|
248
|
+
`wants higher quality, pass \`expand: true\` — the broker rewrites your prompt through the Aurora expander ` +
|
|
249
|
+
`into a richer, more cinematic prompt (the expanded text comes back in the result and is logged); combine ` +
|
|
250
|
+
`with a larger \`size\`. That is your real quality lever — reach for it instead of claiming you need a ` +
|
|
251
|
+
`model you don't have. It also accepts \`reference\`+\`strength\`, passed through to the broker. (b) VIDEO ` +
|
|
252
|
+
`— \`video_generate\` → LTX-Video-0.9.5 on the video broker, with \`expand\` and \`reference_image\` ` +
|
|
253
|
+
`(IMAGE-TO-VIDEO): pass an image and LTX conditions on it as the FIRST FRAME, so the subject in the clip ` +
|
|
254
|
+
`IS that image, in motion. (c) VISION — \`image_analyze\` / \`video_analyze\` → a Qwen2-VL worker on the ` +
|
|
255
|
+
`fleet (REAL vision, not guessing from a filename). It walks an ordered endpoint chain with per-endpoint ` +
|
|
256
|
+
`health-cooldown + an optional cloud fallback, so a cold/busy worker never hard-fails; large images are ` +
|
|
257
|
+
`auto-downscaled before the model sees them. To match a reference, \`image_analyze\` it FIRST, then write ` +
|
|
258
|
+
`your generate prompt from what you actually SAW.` +
|
|
259
|
+
`\n**Likeness is LIVE — this is how you "generate HER".** To make a SPECIFIC person, pass their FACE photo ` +
|
|
260
|
+
`as \`reference\` to \`image_generate\`: it routes to the identity broker (RealVisXL + IP-Adapter-FaceID) ` +
|
|
261
|
+
`which preserves that exact face (arcface-verified) in whatever new scene/pose your prompt describes — you ` +
|
|
262
|
+
`do NOT build your own pipeline for this, the tool does it. The result carries an honest \`axe_identity\` ` +
|
|
263
|
+
`block — if \`identity_applied\` is false or \`fidelity_note\` is weak/none, SAY so; never pass a look-alike ` +
|
|
264
|
+
`off as an exact match. A VIDEO of that person from a shared image works too (its first frame IS the real ` +
|
|
265
|
+
`photo) via \`reference_image\` on \`video_generate\`. Every generation is logged to a provenance flywheel, ` +
|
|
266
|
+
`so the pipeline compounds with use.` +
|
|
267
|
+
`\n## Deep research — \`deep_research\` (cited, multi-source)\nWhen a question needs more than one search — a ` +
|
|
268
|
+
`comparison, a state-of-the-art survey, sourced background — reach for \`deep_research\`: it plans several ` +
|
|
269
|
+
`search angles, fans out \`web_search\` + \`web_fetch\` across them, and returns a brief with inline source ` +
|
|
270
|
+
`citations. A single lookup is faster with plain \`web_search\`; use \`deep_research\` when depth and ` +
|
|
271
|
+
`citations matter. It never invents sources — if the search backend is down it says so rather than guessing.`)) +
|
|
261
272
|
// 96e159b swallowed the OPENING line of the section below ("## Running scripts — …\nFor anything more
|
|
262
273
|
// than a ONE-LINE snippet, write "), orphaning its tail mid-sentence: the LIVE interactive persona
|
|
263
274
|
// shipped as "...rather than guessing.the script to a file…" — no heading, no space (the persona
|
|
@@ -278,72 +289,80 @@ export function basePersona(cwd = process.cwd(), opts = {}) {
|
|
|
278
289
|
`Keep it to ONE short line and put your tool calls in the SAME message right after it — narration must ` +
|
|
279
290
|
`NEVER delay, crowd out, or replace the actual tool call, and never grow long enough to push a big ` +
|
|
280
291
|
`tool-call argument late in your output where it can get cut off.` +
|
|
281
|
-
`\n## Explain your thinking — tables, diagrams, status (Explanatory default)\nThe owner follows a long ` +
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
292
|
+
(opts.lean ? "" : (`\n## Explain your thinking — tables, diagrams, status (Explanatory default)\nThe owner follows a long ` +
|
|
293
|
+
`session by reading YOUR words, not your tool output — so make your reasoning legible, not just your ` +
|
|
294
|
+
`actions. The one-line what-and-why before each batch (above) is the floor; on top of it: for anything ` +
|
|
295
|
+
`non-trivial, surface the REASONING and the TRADE-OFFS — the options you weighed, why you chose this one, ` +
|
|
296
|
+
`what you ruled out — in a few short labeled lines, never a wall of prose. Reach for the right shape: a ` +
|
|
297
|
+
`markdown TABLE for any comparison, option matrix, or status roll-up; a fenced \`mermaid\` DIAGRAM for a ` +
|
|
298
|
+
`flow, a sequence, or an architecture (\`graph TD\`, \`sequenceDiagram\`); short labeled sections (a bold ` +
|
|
299
|
+
`lead-in per point) for everything else. Default to showing, not telling — a table beats a paragraph, a ` +
|
|
300
|
+
`diagram beats ten sentences. End each phase or milestone with a compact STATUS table (columns Done / In ` +
|
|
301
|
+
`progress / Next) so the owner sees where things stand at a glance without scrolling tool logs. This is ` +
|
|
302
|
+
`Operator's Explanatory default: clarity, reasoning, and diagrams are the norm, not the exception — but ` +
|
|
303
|
+
`keep every one of them tight, and never let the explanation delay or crowd out the tool calls themselves.`)) +
|
|
293
304
|
`\n## Parallel tool calls\nWhen the next few steps are INDEPENDENT of each other, issue them as ` +
|
|
294
|
-
`multiple tool calls in a SINGLE message so they run in parallel
|
|
295
|
-
`
|
|
305
|
+
`multiple tool calls in a SINGLE message so they run in parallel — including independent bash ` +
|
|
306
|
+
`commands (they overlap for real; do NOT serialize unrelated shell work). Only serialize when one ` +
|
|
307
|
+
`call's output feeds the next call's input. When you need the contents of several files, use the ` +
|
|
296
308
|
`read_files tool with all paths in ONE call — it reads them in parallel and is far more efficient ` +
|
|
297
309
|
`than issuing many sequential file_read calls.` +
|
|
310
|
+
`\n## Long-running commands\nBuilds, servers, watchers and batches go to shell_background from the start, not ` +
|
|
311
|
+
`the foreground shell. If the user presses ctrl+b on a foreground command it moves to the background ` +
|
|
312
|
+
`(shN) and your call returns at once. A finished background job announces itself with a short notice ` +
|
|
313
|
+
`(exit code, last lines) at your next turn, so do NOT poll bash_output in a loop; read more only when ` +
|
|
314
|
+
`the notice's tail isn't enough.` +
|
|
298
315
|
`\n## Finding things\nTo search file CONTENTS (a symbol, a string, a config key), use the search tool ` +
|
|
299
316
|
`(ripgrep — fast, parallel, .gitignore-aware) scoped to a directory: search {"pattern":"…","path":"src"}, ` +
|
|
300
317
|
`and set files_with_matches to just locate the files before reading them. NEVER run ` +
|
|
301
318
|
`\`find ~/ -maxdepth N | grep | grep\` over the whole home directory — it is slow, hits the command ` +
|
|
302
319
|
`timeout, and can wedge the shell. Narrow FIRST: check the 2-3 most likely directories before any broad ` +
|
|
303
320
|
`sweep, and batch independent searches in ONE message so they run in parallel.\nWhen asked to find a ` +
|
|
304
|
-
`project or file by NAME that is NOT in the working directory: (1)
|
|
321
|
+
`project or file by NAME that is NOT in the working directory: (1) call find_files {"query":"name"} ` +
|
|
322
|
+
`first — it reads the OS search index (whole home, instant) and takes kind/extension/modified_within/size ` +
|
|
323
|
+
`filters; (2) if it reports the index unavailable, run ls ~ to see the REAL top-level ` +
|
|
305
324
|
`folders (projects live in non-obvious ones — e.g. ~/Axwell, ~/.axe/repos, ~/Desktop — not just ` +
|
|
306
|
-
`~/Projects); (
|
|
325
|
+
`~/Projects); (3) then a BOUNDED find scoped to a SPECIFIC directory with a generous timeout — ` +
|
|
307
326
|
`shell_exec {"command":"find ~/.axe/repos -maxdepth 3 -iname \\"*name*\\" 2>/dev/null | head -80",` +
|
|
308
327
|
`"timeout_ms":60000} — never an unbounded find over all of ~ or /. Widen the pattern if a repo may be ` +
|
|
309
328
|
`named differently. Only report not-found after this real search, and say exactly where you looked.` +
|
|
310
|
-
`\n## HTTP requests (curl)\nTo call an HTTP endpoint, prefer the http_request tool (set method, headers, ` +
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
329
|
+
(opts.lean ? "" : (`\n## HTTP requests (curl)\nTo call an HTTP endpoint, prefer the http_request tool (set method, headers, ` +
|
|
330
|
+
`body, timeout) — or web_fetch to READ a page, web_search to FIND one. These run NATIVELY and do NOT go ` +
|
|
331
|
+
`through the shell, so they keep working even when bash is failing or sandboxed. You can also use curl ` +
|
|
332
|
+
`via bash for anything special — custom headers (\`-H\`), methods (\`-X POST\`), following redirects ` +
|
|
333
|
+
`(\`-L\`), form/file uploads; a quick GET is \`curl -sS <url>\`, a JSON POST is \`curl -sS -X POST -H ` +
|
|
334
|
+
`'Content-Type: application/json' -d '<json>' <url>\`. Never conclude you "can't reach a URL" or have "no ` +
|
|
335
|
+
`way to make the request" without trying http_request — if bash won't run curl, http_request is your ` +
|
|
336
|
+
`no-shell fallback for the same call.` +
|
|
337
|
+
`\n## Web search — SearXNG (auto-managed via Docker)\nTo search the web use the web_search tool, not raw ` +
|
|
338
|
+
`curl to a search engine. web_search is backed by a LOCAL SearXNG that Operator runs in Docker and manages ` +
|
|
339
|
+
`for you: on the first search it stands up (or adopts) a container, serves results, and tears it down when ` +
|
|
340
|
+
`idle or at exit — you do not set it up by hand, it is self-provisioning. If web_search reports it can't ` +
|
|
341
|
+
`reach SearXNG because Docker isn't available, the fix is to make sure Docker is running (start Docker ` +
|
|
342
|
+
`Desktop / the docker daemon — you may use your tools to do so), then retry; once Docker is up, the next ` +
|
|
343
|
+
`web_search brings SearXNG up on its own. You can also inspect or control it with /services (ensure / ` +
|
|
344
|
+
`stop). The autopilot SERP is a fallback only when SearXNG is truly unavailable — prefer SearXNG. Treat a ` +
|
|
345
|
+
`"no results / unavailable" web_search as "ensure Docker is running," not as "the web is unreachable."` +
|
|
346
|
+
`\n## Skills — reuse the AXE catalogue\nBefore building a non-trivial capability from scratch, check the ` +
|
|
347
|
+
`skills catalogue: skill_list (or skill_list "<query>") searches 60k+ reusable playbooks (curated + ` +
|
|
348
|
+
`community), and skill_fetch <name> returns one's full instructions to apply. Prefer an existing skill over ` +
|
|
349
|
+
`reinventing it; skill_save keeps a new one for next time.` +
|
|
350
|
+
`\n## Documents & PDFs — a downloadable FILE vs a hosted page\nWhen the owner wants a PDF, report, brief, ` +
|
|
351
|
+
`client deliverable, or a presentation/deck as a FILE they can open or send (e.g. "make a PDF", "put ` +
|
|
352
|
+
`together a presentation pdf", "send it via telegram"), use \`document_generate\` — it renders markdown ` +
|
|
353
|
+
`to a real PDF with NO external tool (never shell out to pandoc/wkhtmltopdf/chrome, never "no PDF tools ` +
|
|
354
|
+
`installed"; it works on every box). When they want a shareable hosted PAGE/URL instead, use ` +
|
|
355
|
+
`\`artifact_create\` (compose.casa). PDF file → document_generate; hosted link → artifact_create.` +
|
|
356
|
+
`\n## AXE surfaces — disambiguate "compose"\n"compose.casa", "composer", "a design/artifact canvas", or ` +
|
|
357
|
+
`"build an artifact/design" mean the AXE **compose.casa** artifact + design surface (artifacts, design ` +
|
|
358
|
+
`rooms, canvases). Act on it with the compose tools (\`compose_create\` / \`compose_canvas\` / ` +
|
|
359
|
+
`\`compose_get\` / \`compose_list\`, under the compose MCP server when the MCP layer is on — the owner ` +
|
|
360
|
+
`turns it on with \`/mcp on\`) or the \`/artifacts\` browser; if those aren't loaded, say compose.casa needs MCP ` +
|
|
361
|
+
`enabled rather than scaffolding a docker-compose.yml for an ARTIFACT request. ` +
|
|
362
|
+
`BUT Docker Compose stays the correct tool for genuine CONTAINER / orchestration work — "docker compose", ` +
|
|
363
|
+
`"docker-compose.yml", "containerize this", "a multi-service / multi-container stack" — use it normally ` +
|
|
364
|
+
`there (that is NOT a compose.casa request). Bare "compose" is ambiguous: choose compose.casa for an ` +
|
|
365
|
+
`artifact/design intent, Docker Compose for a containers/services intent; if genuinely unclear, ask.`)) +
|
|
347
366
|
`\n## Git\nRead repo state with the git_status tool — ONE structured read (branch, ahead/behind, ` +
|
|
348
367
|
`staged/unstaged/untracked). Do not loop re-running raw \`git status\`/\`git add\` to work out state; ` +
|
|
349
368
|
`a clean tree means "nothing to commit", which is success, not a problem to investigate. Commit via ` +
|
|
@@ -412,7 +431,7 @@ export function composeSystemPrompt(o) {
|
|
|
412
431
|
const cwd = o.cwd ?? process.cwd();
|
|
413
432
|
const lean = o.lean === true;
|
|
414
433
|
const interactive = o.interactive === true;
|
|
415
|
-
const identity = o.settings.systemPrompt ?? loadSoul() ?? basePersona(cwd, { ctxTokens: o.ctxTokens, interactive });
|
|
434
|
+
const identity = o.settings.systemPrompt ?? loadSoul() ?? basePersona(cwd, { ctxTokens: o.ctxTokens, interactive, lean });
|
|
416
435
|
// Local-skills index (name: trigger, 4k cap) — the model must KNOW skills exist without spending a
|
|
417
436
|
// skill_list call; bodies stay pull-on-demand via skill_fetch. Skipped in lean (small-ctx) mode like
|
|
418
437
|
// the other heavy sections. Appended exactly like renderToolCatalogue, right before it.
|
package/dist/config/scaffold.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import { get_operator_home } from "./home.js";
|
|
14
|
+
import { AGENTS_MD_TEMPLATE } from "../memory/session-providers.js";
|
|
14
15
|
export const HOME_SCHEMA = 1;
|
|
15
16
|
const HOME_DIRS = ["sessions", "logs", "skills", "memories", "attachments"];
|
|
16
17
|
const GITIGNORE = `# Operator home: credentials, transcripts, memory, the audit log. Never commit any of it.
|
|
@@ -27,6 +28,7 @@ Everything Operator keeps for one identity lives here. This directory is private
|
|
|
27
28
|
| Path | What | Sensitivity |
|
|
28
29
|
|---|---|---|
|
|
29
30
|
| settings.json | your configuration (see settings.example.json) | policy — protected from the agent when the sandbox is on |
|
|
31
|
+
| agents.md | other agents whose sessions /sessions can search (one section per provider) | your config |
|
|
30
32
|
| credentials.json | sign-in metadata; the token is in the OS keychain (file holds it only if there is no keychain) | SECRET (0600) |
|
|
31
33
|
| byo.json | bring-your-own vendor keys when no keychain exists | SECRET (0600) |
|
|
32
34
|
| vault/ | origin-bound website logins for the browser | SECRET |
|
|
@@ -51,6 +53,14 @@ function settingsExample(version) {
|
|
|
51
53
|
selfImprove: { flywheel: false },
|
|
52
54
|
telemetry: { enabled: true },
|
|
53
55
|
autonomy: { maxRounds: 200, maxTurnWallClockSec: 900 },
|
|
56
|
+
loopGuard: {
|
|
57
|
+
_about: "Stops a model that repeats itself. Defaults shown; omit the block to keep them. enabled:false turns it off. hardStop unset = notices only when you are in the session, ends the turn for headless runs; true/false forces it. warnAfter = occurrence that adds a note to the tool result; hardStopAfter = occurrence that ends the turn. caps are per turn (0 disables). repetition:false disables the repeated-output check.",
|
|
58
|
+
enabled: true,
|
|
59
|
+
warnAfter: { identicalCall: 3, exactFailure: 2, sameToolFailure: 3, noProgress: 2 },
|
|
60
|
+
hardStopAfter: { identicalCall: 5, exactFailure: 5, sameToolFailure: 8, noProgress: 5 },
|
|
61
|
+
caps: { webSearches: 50, subagents: 50 },
|
|
62
|
+
repetition: true,
|
|
63
|
+
},
|
|
54
64
|
}, null, 2) + "\n";
|
|
55
65
|
}
|
|
56
66
|
const tooOpen = (mode) => (mode & 0o077) !== 0;
|
|
@@ -102,6 +112,11 @@ export function ensureOperatorHome(opts = {}) {
|
|
|
102
112
|
writeFileSync(readme, README, { mode: 0o644 });
|
|
103
113
|
result.created.push(readme);
|
|
104
114
|
}
|
|
115
|
+
const agents = join(home, "agents.md");
|
|
116
|
+
if (!existsSync(agents)) {
|
|
117
|
+
writeFileSync(agents, AGENTS_MD_TEMPLATE, { mode: 0o644 });
|
|
118
|
+
result.created.push(agents);
|
|
119
|
+
}
|
|
105
120
|
const example = join(home, "settings.example.json");
|
|
106
121
|
if (!existsSync(example) || !readFileSync(example, "utf8").includes(`"_generated_by": "operator ${version}"`)) {
|
|
107
122
|
writeFileSync(example, settingsExample(version), { mode: 0o644 });
|
package/dist/config/settings.js
CHANGED
|
@@ -8,6 +8,30 @@ import { dirname } from "node:path";
|
|
|
8
8
|
import { operatorPath } from "./home.js";
|
|
9
9
|
import { applyManagedPolicy, loadManagedPolicy } from "./managed.js";
|
|
10
10
|
import { DEFAULT_MODEL_ID } from "../router/models.js";
|
|
11
|
+
/** Resolve an endpoint's bearer from config/env/secret-file (first hit wins); undefined when none set
|
|
12
|
+
* (a local/un-gated endpoint). Keeps the raw key out of settings when `apiKeyEnv`/`apiKeyFile` are used. */
|
|
13
|
+
export function resolveEndpointApiKey(ep) {
|
|
14
|
+
if (!ep)
|
|
15
|
+
return undefined;
|
|
16
|
+
const inline = ep.apiKey?.trim();
|
|
17
|
+
if (inline)
|
|
18
|
+
return inline;
|
|
19
|
+
const named = ep.apiKeyEnv ? process.env[ep.apiKeyEnv]?.trim() : undefined;
|
|
20
|
+
if (named)
|
|
21
|
+
return named;
|
|
22
|
+
const def = process.env.KODE_AURORA_TOKEN?.trim();
|
|
23
|
+
if (def)
|
|
24
|
+
return def;
|
|
25
|
+
if (ep.apiKeyFile) {
|
|
26
|
+
try {
|
|
27
|
+
const v = readFileSync(ep.apiKeyFile.replace(/^~(?=\/)/, process.env.HOME ?? "~"), "utf8").trim();
|
|
28
|
+
if (v)
|
|
29
|
+
return v;
|
|
30
|
+
}
|
|
31
|
+
catch { /* missing/unreadable → fall through to undefined */ }
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
11
35
|
// The sole endpoint: Aurora on :8097 at its REAL served context — 307,200 tokens (300K; the llama-server
|
|
12
36
|
// runs --ctx-size 307200 with q8_0 KV cache, standardized on JL1+JL2 2026-09-27). ctxWindow MUST match the
|
|
13
37
|
// server's real --ctx-size: an inflated value (it was 1048576/"1M") makes compaction fire far too late — the
|
|
@@ -15,11 +39,11 @@ import { DEFAULT_MODEL_ID } from "../router/models.js";
|
|
|
15
39
|
// OpenAI-compatible server.
|
|
16
40
|
const DEFAULTS = {
|
|
17
41
|
endpoints: {
|
|
18
|
-
aurora: { base: "http://127.0.0.1:8097", ctxWindow:
|
|
42
|
+
aurora: { base: "http://127.0.0.1:8097", ctxWindow: 1000000, model: "aurora-code-1" },
|
|
19
43
|
// HA hot-standby: JL2 (64GB) serving Aurora @ 300K on the LAN — task #50, replaces the old
|
|
20
44
|
// dolphin3-tools:8b "8k trap". Same model + same real window as primary, so a failover holds any live
|
|
21
45
|
// session instead of truncating it. Point elsewhere / omit to disable.
|
|
22
|
-
failover: { base: "http://192.168.1.146:8097", ctxWindow:
|
|
46
|
+
failover: { base: "http://192.168.1.146:8097", ctxWindow: 1000000, model: "aurora-code-1" },
|
|
23
47
|
},
|
|
24
48
|
modelMode: "local", // default: this node uses its own local model (endpoints.aurora); set "aurora" to use the shared fleet
|
|
25
49
|
fleet: { auroraNodes: ["http://192.168.1.103:8097", "http://192.168.1.146:8097"] }, // JL1, JL2 — the live Aurora serving nodes (priority order)
|
|
@@ -29,21 +53,23 @@ const DEFAULTS = {
|
|
|
29
53
|
temperature: 0.7,
|
|
30
54
|
mcp: false,
|
|
31
55
|
memory: { recall: true },
|
|
32
|
-
selfImprove: { flywheel: true, memory:
|
|
56
|
+
selfImprove: { flywheel: true, memory: true, skills: false, reflect: false }, // trajectory capture ON; memory sink (failure-lesson → .operator/memories.md) ON — the proven closed loop; skills/reflect staged
|
|
33
57
|
verifyGate: { enabled: true, maxNudges: 1 }, // verify-before-done ON; KODE_VERIFY_GATE=0 to run the raw model
|
|
34
58
|
unrestricted: true, // owner's private system — on by default; KODE_UNRESTRICTED=0 to disable
|
|
35
|
-
background: { maxConcurrent: 2, worktree: true }, // ≤2 bg agents at once (KODE_BG_MAX); file-editing ones isolate in a git worktree (KODE_BG_WORKTREE=0 to disable)
|
|
59
|
+
background: { maxConcurrent: 2, worktree: true, jobNotices: "wake" }, // jobNotices: KODE_BG_JOB_NOTICES=wake|queue|off; ≤2 bg agents at once (KODE_BG_MAX); file-editing ones isolate in a git worktree (KODE_BG_WORKTREE=0 to disable)
|
|
36
60
|
ui: { fullscreen: false, reasoning: "think" }, // inline by default; reasoning "think" = the model's thoughts stream dim above the answer every turn (the owner wants to see the process); set "off" for spinner-only, or /think to toggle per-session
|
|
37
|
-
permissions: { mode: "
|
|
61
|
+
permissions: { mode: "gated" }, // ask-by-default: the user decides Allow/Deny; bypass is the opt-out
|
|
38
62
|
telemetry: { enabled: true }, // local-only metrics (silent JSONL); remote sink opt-in via KODE_TELEMETRY_URL
|
|
39
63
|
sandbox: { mode: "off" }, // no isolation by default — enterprise turns it on (KODE_SANDBOX / settings)
|
|
40
64
|
computer: { enabled: false }, // computer control OFF by default; enable with KODE_COMPUTER=1 or settings.json
|
|
65
|
+
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
|
|
41
66
|
search: {}, // web_search backend unset by default; set search.searxngUrl / search.autopilotUrl or the env vars
|
|
42
67
|
// Service lever — JL1 defaults. On a machine without these launchd agents every start step just fails
|
|
43
68
|
// harmlessly and the boot screen falls back to the manual hint (autostart is best-effort by design).
|
|
44
69
|
services: {
|
|
45
70
|
aurora: { autostart: true, launchdLabel: "com.imi.aurora-serve", plistPath: "~/Library/LaunchAgents/com.imi.aurora-serve.plist", waitSec: 90 },
|
|
46
71
|
autopilot: { autostart: true, launchdLabel: "com.axe.autopilot", plistPath: "~/Library/LaunchAgents/com.axe.autopilot.plist", url: "http://127.0.0.1:9333" },
|
|
72
|
+
vision: { autostart: false, launchdLabel: "axe.vision-bot", plistPath: "~/Library/LaunchAgents/axe.vision-bot.plist", url: "http://127.0.0.1:7788", remoteUrl: "http://192.168.1.103:8095" },
|
|
47
73
|
stopOnExit: { searxng: true }, // aurora/autopilot are shared + never stopped; only the SearXNG container is
|
|
48
74
|
},
|
|
49
75
|
activeModel: DEFAULT_MODEL_ID, // /model default — the 1M endpoint, unchanged from before /model existed
|
|
@@ -126,8 +152,16 @@ function applyEnv(s) {
|
|
|
126
152
|
const mtt = Number(process.env.KODE_TURN_MAX_TOKENS); // opt-in per-turn cost ceiling (total tokens)
|
|
127
153
|
if (Number.isFinite(mtt) && mtt > 0)
|
|
128
154
|
out.maxTurnTokens = Math.floor(mtt);
|
|
155
|
+
const lg = process.env.KODE_LOOP_GUARD; // loop guard master switch
|
|
156
|
+
const lgHard = process.env.KODE_LOOP_GUARD_HARD_STOP; // force the hard stop on/off regardless of interactive/headless
|
|
157
|
+
if (lg === "0" || lgHard === "0" || lgHard === "1") {
|
|
158
|
+
out.loopGuard = { ...out.loopGuard, ...(lg === "0" ? { enabled: false } : {}), ...(lgHard === "0" || lgHard === "1" ? { hardStop: lgHard === "1" } : {}) };
|
|
159
|
+
}
|
|
129
160
|
if (process.env.KODE_TELEMETRY === "0")
|
|
130
161
|
out.telemetry = { ...out.telemetry, enabled: false };
|
|
162
|
+
const jn = process.env.KODE_BG_JOB_NOTICES;
|
|
163
|
+
if (jn === "wake" || jn === "queue" || jn === "off")
|
|
164
|
+
out.background = { ...out.background, jobNotices: jn };
|
|
131
165
|
if (process.env.KODE_UNRESTRICTED === "0")
|
|
132
166
|
out.unrestricted = false; // owner's private system; opt out per-box
|
|
133
167
|
const sb = process.env.KODE_SANDBOX;
|
|
@@ -135,7 +169,7 @@ function applyEnv(s) {
|
|
|
135
169
|
out.sandbox = { mode: sb };
|
|
136
170
|
if (process.env.KODE_COMPUTER === "1")
|
|
137
171
|
out.computer = { enabled: true };
|
|
138
|
-
// Service lever: KODE_SERVICES_AUTOSTART=0 disables autostart of
|
|
172
|
+
// Service lever: KODE_SERVICES_AUTOSTART=0 disables autostart of ALL launchd services (Operator then
|
|
139
173
|
// only probes + reports); KODE_STOP_SEARXNG_ON_EXIT=0 keeps the SearXNG container running after exit.
|
|
140
174
|
if (out.services) {
|
|
141
175
|
if (process.env.KODE_SERVICES_AUTOSTART === "0") {
|
|
@@ -143,6 +177,7 @@ function applyEnv(s) {
|
|
|
143
177
|
...out.services,
|
|
144
178
|
aurora: { ...out.services.aurora, autostart: false },
|
|
145
179
|
autopilot: { ...out.services.autopilot, autostart: false },
|
|
180
|
+
vision: { ...out.services.vision, autostart: false },
|
|
146
181
|
};
|
|
147
182
|
}
|
|
148
183
|
if (process.env.KODE_STOP_SEARXNG_ON_EXIT === "0") {
|
|
@@ -261,6 +296,61 @@ function resolveModelMode(s) {
|
|
|
261
296
|
}
|
|
262
297
|
return s;
|
|
263
298
|
}
|
|
299
|
+
// The AXE cloud tier — AXE's own gateway (nginx + LiteLLM → llama.cpp), the LAST-RESORT failover reached
|
|
300
|
+
// only when the whole local fleet is wedged/degraded. Mirrors the `axe-aurora-300k` BUILTIN profile: same
|
|
301
|
+
// served model + window. The base is bare (no `/v1` — aurora.ts appends it); it carries NO explicit token
|
|
302
|
+
// because authHeaders() sends the operator bearer to *.axe.onl automatically (credential-scope guard). Opt
|
|
303
|
+
// out with `settings.endpoints.cloudFailover === false` for a sovereign deployment that must never egress.
|
|
304
|
+
const CLOUD_FAILOVER = {
|
|
305
|
+
name: "axe-cloud",
|
|
306
|
+
base: "https://api.axe.onl",
|
|
307
|
+
model: "aurora-code-1",
|
|
308
|
+
ctxLimit: 307200,
|
|
309
|
+
transport: "openai",
|
|
310
|
+
};
|
|
311
|
+
function hostLabel(base) {
|
|
312
|
+
try {
|
|
313
|
+
const u = new URL(base);
|
|
314
|
+
return `${u.hostname}${u.port ? `-${u.port}` : ""}`;
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return base.replace(/^https?:\/\//, "").replace(/[^\w.-]+/g, "-");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/** Assemble the MULTI-TIER self-heal endpoint chain the router consumes, in priority order:
|
|
321
|
+
* primary (endpoints.aurora)
|
|
322
|
+
* → every OTHER live fleet node (fleet.auroraNodes, same served model + window, deduped)
|
|
323
|
+
* → an explicit back-compat single failover (endpoints.failover, deduped)
|
|
324
|
+
* → the AXE cloud tier (opt-outable via endpoints.cloudFailover:false) as last resort.
|
|
325
|
+
* Deduped by base (trailing-slash-insensitive) so a node already in the chain is never added twice — e.g.
|
|
326
|
+
* resolveModelMode's derived `failover` (== a fleet node) collapses in. Each endpoint resolves its OWN
|
|
327
|
+
* bearer via resolveEndpointApiKey (a local/LAN/un-gated node → none; the cloud tier → the operator bearer
|
|
328
|
+
* via authHeaders scoping). The single source of truth for both cli.tsx (interactive) and the autonomy
|
|
329
|
+
* session factory (headless), so the two paths can never drift to different chains. */
|
|
330
|
+
export function buildEndpointChain(s) {
|
|
331
|
+
const { aurora, failover } = s.endpoints;
|
|
332
|
+
const chain = [];
|
|
333
|
+
const seen = new Set();
|
|
334
|
+
const add = (ep) => {
|
|
335
|
+
const key = ep.base.replace(/\/+$/, "");
|
|
336
|
+
if (seen.has(key))
|
|
337
|
+
return;
|
|
338
|
+
seen.add(key);
|
|
339
|
+
chain.push(ep);
|
|
340
|
+
};
|
|
341
|
+
add({ name: "operator-1m", base: aurora.base, model: aurora.model, ctxLimit: aurora.ctxWindow, token: resolveEndpointApiKey(aurora) });
|
|
342
|
+
for (const base of (s.fleet?.auroraNodes ?? []).filter(Boolean)) {
|
|
343
|
+
const cfg = { base, model: aurora.model, ctxWindow: aurora.ctxWindow };
|
|
344
|
+
add({ name: `fleet-${hostLabel(base)}`, base, model: aurora.model, ctxLimit: aurora.ctxWindow, token: resolveEndpointApiKey(cfg) });
|
|
345
|
+
}
|
|
346
|
+
if (failover)
|
|
347
|
+
add({ name: "failover", base: failover.base, model: failover.model, ctxLimit: failover.ctxWindow, token: resolveEndpointApiKey(failover) });
|
|
348
|
+
if (s.endpoints.cloudFailover !== false) {
|
|
349
|
+
const cfg = { base: CLOUD_FAILOVER.base, model: CLOUD_FAILOVER.model, ctxWindow: CLOUD_FAILOVER.ctxLimit };
|
|
350
|
+
add({ ...CLOUD_FAILOVER, token: resolveEndpointApiKey(cfg) });
|
|
351
|
+
}
|
|
352
|
+
return chain;
|
|
353
|
+
}
|
|
264
354
|
// The seat this process resolved at startup (auth/identity.ts). Re-applied by every loadSettings() so a later
|
|
265
355
|
// caller (cron, delegate_task) can never see a WIDER tier than the one the identity was narrowed to.
|
|
266
356
|
let activeSeat = null;
|