@0perator/operator 0.1.360-next.0 → 0.1.360-next.2
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/session-factory.js +6 -2
- package/dist/browser/session.js +61 -13
- package/dist/cli.js +87 -58
- package/dist/config/settings.js +27 -6
- package/dist/config/skills-index.js +4 -0
- package/dist/config/toolchain.js +14 -1
- package/dist/engine/aurora.js +19 -10
- package/dist/engine/speed-compaction.js +37 -0
- package/dist/gateway-cli.js +14 -5
- package/dist/router/models.js +46 -12
- package/dist/services/preflight.js +31 -8
- package/dist/session.js +48 -7
- package/dist/toolchain/toolchain.py +20 -3
- package/dist/tools/registry.js +230 -45
- package/dist/tools/vision-media.js +162 -0
- package/dist/ui/modelPicker.js +26 -8
- package/dist/update.js +37 -8
- package/package.json +1 -1
|
@@ -10,10 +10,11 @@ import { composeSystemPrompt, subagentSystemPrompt } from "../config/persona.js"
|
|
|
10
10
|
import { SUBAGENT_ROLES, SUBAGENT_TOOL_DENY } from "../engine/grandmaster.js";
|
|
11
11
|
import { ensureScratchDir } from "../config/scratch.js";
|
|
12
12
|
import { modelCtxFor, leanHarnessFor, DEFAULT_MODEL_ID } from "../router/models.js";
|
|
13
|
-
import { compactionThreshold, compactionCeilingTokens, turnWallClockMs, buildEndpointChain } from "../config/settings.js";
|
|
13
|
+
import { compactionThreshold, compactionCeilingTokens, compactionMinDecodeTps, turnWallClockMs, buildEndpointChain } from "../config/settings.js";
|
|
14
14
|
import { resolveMode } from "../classifier/modes.js";
|
|
15
15
|
import { classifierConfig } from "../classifier/config.js";
|
|
16
16
|
import { auroraOnDemand } from "../services/preflight.js";
|
|
17
|
+
import { setSpeculation, speculationEnabled } from "../engine/aurora.js";
|
|
17
18
|
/** Build the Aurora router from settings — the headless twin of cli.tsx's buildRouter(). Both share the one
|
|
18
19
|
* multi-tier chain builder (primary → other fleet nodes → back-compat single failover → cloud), so a
|
|
19
20
|
* wedged/degraded endpoint fails over through the whole fleet before the turn can error. */
|
|
@@ -39,6 +40,7 @@ export function envSubagentRole(env = process.env) {
|
|
|
39
40
|
* MCP tool set directly. Permissions default to the owner's configured policy. */
|
|
40
41
|
export function createAutonomySession(settings, opts = {}) {
|
|
41
42
|
const role = opts.role ?? envSubagentRole();
|
|
43
|
+
setSpeculation(speculationEnabled(settings)); // GW-26: the owner's opt-out reaches headless, ACP and delegated runs
|
|
42
44
|
const session = new Session({
|
|
43
45
|
systemPrompt: role
|
|
44
46
|
? subagentSystemPrompt({ cwd: opts.cwd ?? process.cwd(), ctxTokens: modelCtxFor(settings.activeModel, settings.models), type: role })
|
|
@@ -65,9 +67,10 @@ export function createAutonomySession(settings, opts = {}) {
|
|
|
65
67
|
frontDoor: settings.frontDoor, // a message the gateway's front door answers (engine/front-door.ts) never runs a full turn
|
|
66
68
|
features: settings.features, // feature flags — registers flag-gated tools (e.g. cloudAgents) only when on
|
|
67
69
|
activeModel: settings.activeModel,
|
|
70
|
+
fallbackModel: settings.fallbackModel,
|
|
68
71
|
// A local Aurora loads for the first turn on it (owner, 11/03), never for the run starting: a run on moa or cortana
|
|
69
72
|
// (setModel below) never loads it.
|
|
70
|
-
onDemand: auroraOnDemand(settings.endpoints.aurora, settings.services?.aurora, () => buildRouterFromSettings(settings)),
|
|
73
|
+
onDemand: auroraOnDemand(settings.endpoints.aurora, settings.services?.aurora, () => buildRouterFromSettings(settings), undefined, (line) => process.stderr.write(`[operator] ${line}\n`)),
|
|
71
74
|
contextPin: settings.contextPin, // the owner's /context choice (KODE_CONTEXT wins in loadSettings) holds for headless, ACP and delegated runs too
|
|
72
75
|
contextFloor: settings.contextFloor,
|
|
73
76
|
permissions: opts.permissions ?? settings.permissions,
|
|
@@ -77,6 +80,7 @@ export function createAutonomySession(settings, opts = {}) {
|
|
|
77
80
|
telemetry: settings.telemetry,
|
|
78
81
|
compactionThreshold: compactionThreshold(settings),
|
|
79
82
|
compactionCeilingTokens: compactionCeilingTokens(settings, "autonomy"), // the owner's compaction.autonomyCeilingTokens / env, else no ceiling — never the interactive ceilingTokens, so a snappy interactive setting can't throttle an unattended build into a compaction-thrash loop
|
|
83
|
+
compactionMinDecodeTps: compactionMinDecodeTps(settings, "autonomy"), // only compaction.autonomyMinDecodeTps; the interactive floor never reaches an unattended run
|
|
80
84
|
sleepConsolidation: settings.autonomy?.sleepConsolidation, // headless autonomy ("operator run/loop/dream") consolidates on idle too (0.1.177)
|
|
81
85
|
...opts.extra,
|
|
82
86
|
});
|
package/dist/browser/session.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
// respawns transparently. Tools are split READ vs ACT so the registry-derived permission policy
|
|
5
5
|
// (0.1.226) can let gated/plan mode READ pages freely while every page MUTATION stays gated.
|
|
6
6
|
import { CdpConnection, launchChrome, checkNavigationUrl, evalResultToText, fillScript, BROWSER_CONSTANTS, } from "./cdp.js";
|
|
7
|
+
/** A full-page capture stops here (CSS px): past it Chrome's capture gets slow and the PNG heavy. */
|
|
8
|
+
export const MAX_PAGE_PX = 16_384;
|
|
7
9
|
async function nodeImport(id) {
|
|
8
10
|
const g = globalThis;
|
|
9
11
|
try {
|
|
@@ -14,6 +16,20 @@ async function nodeImport(id) {
|
|
|
14
16
|
catch { /* dynamic */ }
|
|
15
17
|
return import(id);
|
|
16
18
|
}
|
|
19
|
+
/** `<cache>/browser/<kind>-<ms>` (no extension), or the OS temp dir when the Operator home is not writable. */
|
|
20
|
+
async function shotBase(kind) {
|
|
21
|
+
const { mkdirSync } = await nodeImport("node:fs");
|
|
22
|
+
try {
|
|
23
|
+
const { operatorPath } = await nodeImport("../config/home.js");
|
|
24
|
+
const dir = operatorPath("cache", "browser");
|
|
25
|
+
mkdirSync(dir, { recursive: true });
|
|
26
|
+
return `${dir}/${kind}-${Date.now()}`;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
const os = await nodeImport("node:os");
|
|
30
|
+
return `${os.tmpdir()}/kode-${kind}-${Date.now()}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
17
33
|
class BrowserSession {
|
|
18
34
|
conn = null;
|
|
19
35
|
proc = null;
|
|
@@ -57,12 +73,13 @@ class BrowserSession {
|
|
|
57
73
|
throw new Error("browser: no active tab — call open first");
|
|
58
74
|
return this.tabs[this.active];
|
|
59
75
|
}
|
|
76
|
+
/** Resolves to Chrome's network error for the load (net::ERR_NAME_NOT_RESOLVED, …), or undefined. */
|
|
60
77
|
async navigate(conn, tab, url) {
|
|
61
78
|
const blocked = checkNavigationUrl(url);
|
|
62
79
|
if (blocked)
|
|
63
80
|
throw new Error(blocked);
|
|
64
81
|
const loadFired = conn.once("Page.loadEventFired"); // subscribe BEFORE navigate so we never miss it
|
|
65
|
-
await conn.send("Page.navigate", { url }, tab.sessionId);
|
|
82
|
+
const nav = await conn.send("Page.navigate", { url }, tab.sessionId);
|
|
66
83
|
const settled = await Promise.race([
|
|
67
84
|
loadFired.then(() => "load"),
|
|
68
85
|
new Promise((res) => setTimeout(() => res("timeout"), BROWSER_CONSTANTS.NAV_TIMEOUT_MS)),
|
|
@@ -78,6 +95,43 @@ class BrowserSession {
|
|
|
78
95
|
catch {
|
|
79
96
|
tab.url = url;
|
|
80
97
|
}
|
|
98
|
+
return nav?.errorText || undefined;
|
|
99
|
+
}
|
|
100
|
+
/** Render `url` in a tab of its own, sized `width`×`height`, and save a PNG (the viewport, or the whole page up to
|
|
101
|
+
* MAX_PAGE_PX tall). A long page also yields up to `tiles` viewport-sized slices spread top to bottom, so vision
|
|
102
|
+
* sees readable pieces instead of one strip downscaled to nothing. The `browser` tool's tabs are left as they were. */
|
|
103
|
+
async capture(url, o) {
|
|
104
|
+
const conn = await this.ensure();
|
|
105
|
+
const before = this.active;
|
|
106
|
+
const tab = await this.newTab(conn, "about:blank");
|
|
107
|
+
try {
|
|
108
|
+
await conn.send("Emulation.setDeviceMetricsOverride", { width: o.width, height: o.height, deviceScaleFactor: 1, mobile: false }, tab.sessionId);
|
|
109
|
+
const loadError = await this.navigate(conn, tab, url);
|
|
110
|
+
const value = async (expression) => (await conn.send("Runtime.evaluate", { expression, returnByValue: true }, tab.sessionId).catch(() => undefined))?.result?.value;
|
|
111
|
+
const title = (await value("document.title")) ?? "";
|
|
112
|
+
const status = (await value("performance.getEntriesByType('navigation')[0]?.responseStatus || 0")) || undefined;
|
|
113
|
+
const fullHeight = Math.max(o.height, Math.ceil((await value("Math.max(document.documentElement.scrollHeight, document.body ? document.body.scrollHeight : 0)")) ?? o.height));
|
|
114
|
+
const height = o.fullPage ? Math.min(fullHeight, MAX_PAGE_PX) : o.height;
|
|
115
|
+
const shoot = async (y, h, path) => {
|
|
116
|
+
const shot = await conn.send("Page.captureScreenshot", { format: "png", captureBeyondViewport: o.fullPage, clip: { x: 0, y, width: o.width, height: h, scale: 1 } }, tab.sessionId);
|
|
117
|
+
const { writeFileSync } = await nodeImport("node:fs");
|
|
118
|
+
writeFileSync(path, shot.data, "base64");
|
|
119
|
+
return path;
|
|
120
|
+
};
|
|
121
|
+
const base = await shotBase("page");
|
|
122
|
+
const path = await shoot(0, height, `${base}.png`);
|
|
123
|
+
const tiles = [];
|
|
124
|
+
const n = o.fullPage && height > o.height * 1.5 ? Math.min(Math.max(1, o.tiles), Math.ceil(height / o.height)) : 0;
|
|
125
|
+
for (let i = 0; i < n; i++)
|
|
126
|
+
tiles.push(await shoot(n === 1 ? 0 : Math.round((i * (height - o.height)) / (n - 1)), o.height, `${base}-${i + 1}.png`));
|
|
127
|
+
const probe = o.probe ? await value(o.probe) : undefined;
|
|
128
|
+
return { path, tiles, title, finalUrl: tab.url, status, loadError, width: o.width, height, fullHeight, probe };
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
await conn.send("Target.closeTarget", { targetId: tab.targetId }).catch(() => undefined);
|
|
132
|
+
this.tabs = this.tabs.filter((t) => t !== tab);
|
|
133
|
+
this.active = Math.min(before, this.tabs.length - 1);
|
|
134
|
+
}
|
|
81
135
|
}
|
|
82
136
|
async evaluate(expr, awaitPromise = false) {
|
|
83
137
|
const conn = await this.ensure();
|
|
@@ -171,18 +225,8 @@ class BrowserSession {
|
|
|
171
225
|
case "screenshot": {
|
|
172
226
|
const shot = await conn.send("Page.captureScreenshot", { format: "png" }, this.tab().sessionId);
|
|
173
227
|
const bytes = Math.round(shot.data.length * 3 / 4); // base64 → raw size
|
|
174
|
-
const {
|
|
175
|
-
const
|
|
176
|
-
let path;
|
|
177
|
-
try {
|
|
178
|
-
const dir = operatorPath("cache", "browser");
|
|
179
|
-
mkdirSync(dir, { recursive: true });
|
|
180
|
-
path = `${dir}/shot-${Date.now()}.png`;
|
|
181
|
-
}
|
|
182
|
-
catch {
|
|
183
|
-
const os = await nodeImport("node:os");
|
|
184
|
-
path = `${os.tmpdir()}/kode-shot-${Date.now()}.png`;
|
|
185
|
-
}
|
|
228
|
+
const { writeFileSync } = await nodeImport("node:fs");
|
|
229
|
+
const path = `${await shotBase("shot")}.png`;
|
|
186
230
|
writeFileSync(path, shot.data, "base64");
|
|
187
231
|
return `screenshot ${path} (${Math.round(bytes / 1024)} KB) — pass to image_analyze if you must see pixels; prefer text/eval`;
|
|
188
232
|
}
|
|
@@ -267,6 +311,10 @@ export const browserSessionHooks = {
|
|
|
267
311
|
activeHref: () => session().href(),
|
|
268
312
|
fillPair: (u, uv, p, pv) => session().fillPair(u, uv, p, pv),
|
|
269
313
|
};
|
|
314
|
+
/** image_analyze `page` renders through the same Chrome as the `browser` tool; tests replace `capture`. */
|
|
315
|
+
export const pageCaptureHooks = {
|
|
316
|
+
capture: (url, o) => session().capture(url, o),
|
|
317
|
+
};
|
|
270
318
|
/** run() for the `browser` tool (ACT side, plus reads for convenience in ungated modes). */
|
|
271
319
|
export async function runBrowser(args) {
|
|
272
320
|
const need = BROWSER_NEEDS[String(args.action)];
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { restKey } from "./ui/Composer.js";
|
|
|
13
13
|
import { mastheadLines } from "./ui/Masthead.js";
|
|
14
14
|
import { shouldPromptPlanExit, resolvePlanExit, PLAN_EXIT_OPTIONS } from "./ui/planExit.js";
|
|
15
15
|
import { initialMode, modePolicy, nextMode, parseMode, planToggleTarget } from "./permissions/modes.js";
|
|
16
|
-
import { FREE_ROW_PRESETS, connectedAccounts, looksLikeSecret, contextLine, contextPickerView, keyStoredLine, markModelRows, modelLine, modelPickerView, onceEach, pickerAnswer, providerPickerView, rereadConfirmView, wantsContextStep, wantsRereadConfirm } from "./ui/modelPicker.js";
|
|
16
|
+
import { FREE_ROW_PRESETS, connectedAccounts, isMainModel, looksLikeSecret, contextLine, contextPickerView, keyStoredLine, mainPickerView, markModelRows, modelLine, modelPickerView, onceEach, pickerAnswer, providerPickerView, rereadConfirmView, wantsContextStep, wantsRereadConfirm } from "./ui/modelPicker.js";
|
|
17
17
|
import { RemoteHost } from "./remote/host.js";
|
|
18
18
|
import { REMOTE_SAFE_COMMANDS, REMOTE_SAFE_COMMAND_NAMES } from "./remote/safe-commands.js";
|
|
19
19
|
import { newCode, pairURL } from "./remote/pairing.js";
|
|
@@ -35,11 +35,11 @@ import { turnScoped } from "./ui/turnScope.js";
|
|
|
35
35
|
import { applyDrafts, bufferDraft, seedLiveTools, settleLiveTool, startLiveTool } from "./ui/liveTools.js";
|
|
36
36
|
import { Session } from "./session.js";
|
|
37
37
|
import { buildMemory } from "./memory/providers.js";
|
|
38
|
-
import { cacheBustNotice, anyReachable } from "./engine/aurora.js";
|
|
38
|
+
import { cacheBustNotice, anyReachable, setSpeculation, speculationEnabled } from "./engine/aurora.js";
|
|
39
39
|
import { seedCalibration } from "./engine/calibration-seed.js";
|
|
40
40
|
import { AuroraRouter } from "./router/router.js";
|
|
41
41
|
import { BackgroundAgents } from "./background/index.js";
|
|
42
|
-
import { loadSettings, saveSettings, compactionThreshold, compactionCeilingTokens, rcAutostart, eagerAuthAtBoot, applySeat, setActiveSeat, buildEndpointChain, parseContextArg, nextContextPin } from "./config/settings.js";
|
|
42
|
+
import { loadSettings, saveSettings, compactionThreshold, compactionCeilingTokens, compactionMinDecodeTps, rcAutostart, eagerAuthAtBoot, applySeat, setActiveSeat, buildEndpointChain, parseContextArg, nextContextPin } from "./config/settings.js";
|
|
43
43
|
import { resolveSeat } from "./auth/identity.js";
|
|
44
44
|
import { PermissionPolicy } from "./permissions/index.js";
|
|
45
45
|
import { caps } from "./ui/capabilities.js";
|
|
@@ -47,12 +47,13 @@ import { composeSystemPrompt, appendMemory, subagentSystemPrompt } from "./confi
|
|
|
47
47
|
import { SUBAGENT_ROLES, SUBAGENT_TOOL_DENY, roleCanWrite } from "./engine/grandmaster.js";
|
|
48
48
|
import { applyToolsBinPath, operatorPath } from "./config/home.js";
|
|
49
49
|
import { ensureOperatorHome } from "./config/scaffold.js";
|
|
50
|
-
import { listLocalSkills } from "./config/skills-index.js";
|
|
50
|
+
import { listLocalSkills, skillCommand } from "./config/skills-index.js";
|
|
51
51
|
import { modelCtxFor, leanHarnessFor, selectModel, modelRegistry, fmtCtx, shortName, BYO_PRESETS, DEFAULT_MODEL_ID } from "./router/models.js";
|
|
52
52
|
import { fetchPortalModels, offlineNote, portalIdFor } from "./router/portal.js";
|
|
53
53
|
import { fetchFreeModels } from "./router/free-models.js";
|
|
54
54
|
import { describeTurnError } from "./engine/net-error.js";
|
|
55
55
|
import { fallbackNotice, primaryRecoveredLine, recoveryLine } from "./engine/continuation.js";
|
|
56
|
+
import { speedCompactionLine } from "./engine/speed-compaction.js";
|
|
56
57
|
import { hasByoToken, setByoToken } from "./auth/byo.js";
|
|
57
58
|
import { getDiscoveredModels } from "./router/discovery.js";
|
|
58
59
|
import { disposeShellSession, getAgentTasks, registry } from "./tools/registry.js";
|
|
@@ -161,6 +162,7 @@ const HOME_SCAFFOLD = ensureOperatorHome({ version: VERSION });
|
|
|
161
162
|
// Bridge the resolved (managed + contextual-floor) sandbox mode to the tool layer: sandboxMode() reads
|
|
162
163
|
// KODE_SANDBOX at exec time, so a settings/managed "strict" that is never bridged would run unconfined.
|
|
163
164
|
applySandboxMode(settings.sandbox.mode);
|
|
165
|
+
setSpeculation(speculationEnabled(settings)); // GW-26: settings.speculation:false / KODE_SPECULATION=0 restore the per-request ngram disable
|
|
164
166
|
// operator-home-v2 phase 5: the managed owner-CLI toolkit is a SINGLE PATH addition
|
|
165
167
|
// ($KODE_HOME/tools/bin, materialized by operator-home/tools/toolkit-verify.sh). Projected once at
|
|
166
168
|
// startup so every child inherits it — persistent bash, exec-file tools, in-process cron sessions.
|
|
@@ -585,6 +587,7 @@ const HELP = [
|
|
|
585
587
|
" /memory [query] show remembered notes (all, or matching query)",
|
|
586
588
|
" /allow <tool:args> auto-allow a tool+args glob pattern in gated mode (e.g. bash:npm test*)",
|
|
587
589
|
" /skill <name|off> activate a skill as a system-prompt directive (/skill off to deactivate)",
|
|
590
|
+
" /<skill> [message] any installed skill is its own command; the rest of the line is your first message",
|
|
588
591
|
" /mcp [list|on|off] MCP servers and their tools (pick a server to browse its tools) · on/off (saved) · /mcp reload (from disk) · /mcp add powertools <root>",
|
|
589
592
|
" /login · /logout · /whoami /login opens the browser to approve; or /login <email> for a 6-digit code (then /login <code>); /login <token>",
|
|
590
593
|
" /agents [id] detailed sub-agent status, or /agents <id> for a deep view + controls (msg/stop/report)",
|
|
@@ -783,7 +786,7 @@ function Root() {
|
|
|
783
786
|
auroraHookRef.current = auroraOnDemand(settings.endpoints.aurora, settings.services?.aurora, buildRouter, () => {
|
|
784
787
|
push({ kind: "message", message: { id: nextId(), role: "system", content: "aurora is not loaded — loading it for this turn…" } });
|
|
785
788
|
setPhase("loading");
|
|
786
|
-
});
|
|
789
|
+
}, (line) => push({ kind: "message", message: { id: nextId(), role: "system", content: line } }));
|
|
787
790
|
}
|
|
788
791
|
return auroraHookRef.current(signal);
|
|
789
792
|
};
|
|
@@ -807,6 +810,7 @@ function Root() {
|
|
|
807
810
|
sleepConsolidation: settings.autonomy?.sleepConsolidation, // idle "dreaming": consolidate transcript→memory + run the flywheel while the owner is away (0.1.177 — was never threaded through, so it never fired)
|
|
808
811
|
compactionThreshold: compactionThreshold(settings), // settings.compaction.threshold / KODE_COMPACTION_THRESHOLD; undefined → derived from the served window
|
|
809
812
|
compactionCeilingTokens: compactionCeilingTokens(settings, "interactive"), // the owner's compaction.ceilingTokens / env, else no ceiling. Headless autonomy reads its own (session-factory.ts)
|
|
813
|
+
compactionMinDecodeTps: compactionMinDecodeTps(settings, "interactive"), // compaction.minDecodeTps / KODE_COMPACT_MIN_TPS: compact when sustained decode falls under it; undefined → off
|
|
810
814
|
temperature: settings.temperature,
|
|
811
815
|
recall: settings.memory.recall,
|
|
812
816
|
models: MERGED_MODELS, // discovered fleet nodes + settings.models overrides (built-ins in router/models.ts)
|
|
@@ -817,6 +821,7 @@ function Root() {
|
|
|
817
821
|
frontDoor: settings.frontDoor, // the gateway answers a message that needs no tools in the session's voice (engine/front-door.ts)
|
|
818
822
|
features: settings.features, // feature flags — registers flag-gated tools (e.g. cloudAgents) only when on
|
|
819
823
|
activeModel: settings.activeModel, // persisted /model choice, applied at startup
|
|
824
|
+
fallbackModel: settings.fallbackModel, // what answers a turn whose model failed on every leg; undefined → the router's `main`
|
|
820
825
|
contextPin: settings.contextPin, // persisted /context · ctrl+x choice (KODE_CONTEXT wins); unset = the served window
|
|
821
826
|
contextFloor: settings.contextFloor,
|
|
822
827
|
permissions: START_POLICY.permissions, // the starting mode's policy (Autonomous, or Gated when the settings say so)
|
|
@@ -1155,10 +1160,10 @@ function Root() {
|
|
|
1155
1160
|
// session on another model (moa, cortana) never needs it.
|
|
1156
1161
|
const primaryOk = reports.find((r) => r.name === "aurora")?.state === "idle" || (await session.health().catch(() => false));
|
|
1157
1162
|
// No local model is not a failed boot either when a later leg of the same chain answers: the router falls
|
|
1158
|
-
// through to it on the first turn (a new user's machine has only the cloud tier).
|
|
1159
|
-
//
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1163
|
+
// through to it on the first turn (a new user's machine has only the cloud tier). The Aurora row's legs are the
|
|
1164
|
+
// shell chain; any other gateway row (operator-flash, the fresh-install default) has its own public leg.
|
|
1165
|
+
const laterLegs = session.currentModel() === DEFAULT_MODEL_ID ? buildEndpointChain(settings).map((e) => e.base) : session.endpoints().map((e) => e.base);
|
|
1166
|
+
const ok = primaryOk || (await anyReachable(laterLegs.slice(1)).catch(() => false));
|
|
1162
1167
|
setBoot(ok ? "ready" : "down");
|
|
1163
1168
|
if (!ok) {
|
|
1164
1169
|
const a = reports.find((r) => r.name === "aurora");
|
|
@@ -1468,6 +1473,7 @@ function Root() {
|
|
|
1468
1473
|
if (!compactRef.current)
|
|
1469
1474
|
setPhase("sent");
|
|
1470
1475
|
},
|
|
1476
|
+
onSpeedCompaction: (e) => sys(speedCompactionLine(e)),
|
|
1471
1477
|
onCompactionStart: ({ before }) => {
|
|
1472
1478
|
compactRef.current = { before, startedAt: Date.now(), ring: [], wrote: 0 };
|
|
1473
1479
|
setStepLabel("compacting context");
|
|
@@ -2211,57 +2217,71 @@ function Root() {
|
|
|
2211
2217
|
askKey(a.entry); });
|
|
2212
2218
|
};
|
|
2213
2219
|
const active = s.currentModel();
|
|
2214
|
-
|
|
2215
|
-
const
|
|
2216
|
-
|
|
2220
|
+
// Two screens (0.1.361): the main rows + "More models…", which opens every other row and the connect action.
|
|
2221
|
+
const view = (more) => {
|
|
2222
|
+
const o = { active, servedCtx: s.servedContext(), staleFree: freeStaleRef.current, cost: (m) => costOf(m.id), cols: termCols() };
|
|
2223
|
+
return more ? modelPickerView(s.modelRegistry().filter((m) => !isMainModel(m)), o) : mainPickerView(s.modelRegistry(), o);
|
|
2224
|
+
};
|
|
2217
2225
|
let cat;
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
});
|
|
2242
|
-
openPicker(v.question, v.rows, v.choices, (c) => {
|
|
2243
|
-
if (!("entry" in c))
|
|
2244
|
-
return; // Esc / "chat about it": nothing changes
|
|
2245
|
-
if (c.entry === "switch")
|
|
2226
|
+
let refresh = () => { };
|
|
2227
|
+
const show = (more) => {
|
|
2228
|
+
const first = view(more);
|
|
2229
|
+
let onScreen = first.rows;
|
|
2230
|
+
const redraw = openPicker(more ? "More models" : "Select a model", first.rows, first.entries, (a) => {
|
|
2231
|
+
if ("typed" in a) {
|
|
2232
|
+
apply(a.typed);
|
|
2233
|
+
return;
|
|
2234
|
+
} // the typed-id escape: an explicit id skips the context step
|
|
2235
|
+
if (a.entry.kind === "more") {
|
|
2236
|
+
show(true);
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
if (a.entry.kind === "connect") {
|
|
2240
|
+
connectProvider();
|
|
2241
|
+
return;
|
|
2242
|
+
}
|
|
2243
|
+
const id = a.entry.profile.id;
|
|
2244
|
+
const go = () => { const chosen = apply(id); if (chosen && wantsContextStep(chosen, s.servedContext()))
|
|
2245
|
+
openContextPicker(); };
|
|
2246
|
+
// A pick that costs a long re-read asks once, with the price: switch now, compact here first, or stay.
|
|
2247
|
+
const cost = costOf(id);
|
|
2248
|
+
if (!cost || !wantsRereadConfirm(cost)) {
|
|
2246
2249
|
go();
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2250
|
+
return;
|
|
2251
|
+
}
|
|
2252
|
+
const here = s.currentModel() === DEFAULT_MODEL_ID ? "aurora" : s.currentModel();
|
|
2253
|
+
const est = s.compactionEstimate();
|
|
2254
|
+
const v = rereadConfirmView({
|
|
2255
|
+
target: a.entry.profile.label, current: here, cost,
|
|
2256
|
+
compact: est ? { afterMax: est.afterMax, summaryMax: est.summaryMax, decode: readRates.decodeRate(s.currentModel()) } : undefined,
|
|
2257
|
+
});
|
|
2258
|
+
openPicker(v.question, v.rows, v.choices, (c) => {
|
|
2259
|
+
if (!("entry" in c))
|
|
2260
|
+
return; // Esc / "chat about it": nothing changes
|
|
2261
|
+
if (c.entry === "switch")
|
|
2262
|
+
go();
|
|
2263
|
+
else if (c.entry === "compact") {
|
|
2264
|
+
flow.afterCompaction(go);
|
|
2265
|
+
void slashRef.current("/compact");
|
|
2266
|
+
} // compacts on the cache-warm model, then switches — before anything waiting can start a turn
|
|
2267
|
+
else
|
|
2268
|
+
sys(`stayed on ${here}`);
|
|
2269
|
+
});
|
|
2253
2270
|
});
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2271
|
+
// Live state markers from the portal and the free rows: the picker opens instantly; whichever lands re-renders
|
|
2272
|
+
// the picker on screen (markers on the same rows, free rows in their place before MOA) — only when something changed.
|
|
2273
|
+
refresh = () => {
|
|
2274
|
+
const v = view(more);
|
|
2275
|
+
const rows = markModelRows(v, cat);
|
|
2276
|
+
if (rows.length === onScreen.length && rows.every((t, i) => t === onScreen[i]))
|
|
2277
|
+
return;
|
|
2278
|
+
onScreen = rows;
|
|
2279
|
+
redraw(rows, v.entries);
|
|
2280
|
+
};
|
|
2281
|
+
if (cat)
|
|
2282
|
+
refresh();
|
|
2264
2283
|
};
|
|
2284
|
+
show(false);
|
|
2265
2285
|
void fetchPortalModels().then((c) => { if (c) {
|
|
2266
2286
|
cat = c;
|
|
2267
2287
|
refresh();
|
|
@@ -3178,7 +3198,16 @@ function Root() {
|
|
|
3178
3198
|
sys(`▮ Pair this desktop — in the Operator app tap "Pair Desktop → Scan QR" and point it here:\n\n${qr}\n\n …or choose "Paste code" and paste:\n ${link}\n\n End-to-end encrypted — the relay only ever sees a blind id, never the code. /pair again to stop.`);
|
|
3179
3199
|
break;
|
|
3180
3200
|
}
|
|
3181
|
-
default:
|
|
3201
|
+
default: {
|
|
3202
|
+
const skill = skillCommand(name);
|
|
3203
|
+
if (!skill) {
|
|
3204
|
+
sys(`unknown command /${name} — try /help`);
|
|
3205
|
+
break;
|
|
3206
|
+
}
|
|
3207
|
+
await slashRef.current(`/skill ${skill}`);
|
|
3208
|
+
if (arg && s.currentSkill() === skill)
|
|
3209
|
+
submitRef.current(arg);
|
|
3210
|
+
}
|
|
3182
3211
|
}
|
|
3183
3212
|
}, [exit, sys, bg, authUser, approval, settleApproval, settleQuestion, applyMode, applyContext, openPicker, openContextPicker, refreshFreeRows, remoteCommand, remotePrompt]);
|
|
3184
3213
|
const onSubmit = useCallback((text) => {
|
|
@@ -3621,7 +3650,7 @@ function Root() {
|
|
|
3621
3650
|
if (boot === "down") {
|
|
3622
3651
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "red", children: "Can't reach Operator on the configured endpoint." }), bootDetail ? _jsx(Text, { dimColor: true, children: bootDetail }) : null, session.currentModel() === DEFAULT_MODEL_ID
|
|
3623
3652
|
? _jsxs(Text, { dimColor: true, children: ["The Operator model is launchd-owned. Recover it with: launchctl kickstart -k gui/$(id -u)/", settings.services?.aurora?.launchdLabel ?? "co.0perator.gateway"] })
|
|
3624
|
-
: _jsxs(Text, { dimColor: true, children: ["Start on
|
|
3653
|
+
: _jsxs(Text, { dimColor: true, children: ["Start on another model: set \"activeModel\" in settings.json to one /model lists, then /model ", session.currentModel(), " once it is reachable."] })] }));
|
|
3625
3654
|
}
|
|
3626
3655
|
// While a turn runs, show a LIVE line: braille spinner + climbing token count + live tok/s + elapsed
|
|
3627
3656
|
// seconds. When idle, show the last turn's final "N tok · X tok/s · Ys". Never freeze on the previous
|
package/dist/config/settings.js
CHANGED
|
@@ -6,7 +6,7 @@ import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
|
6
6
|
import { dirname } from "node:path";
|
|
7
7
|
import { operatorPath } from "./home.js";
|
|
8
8
|
import { applyManagedPolicy, loadManagedPolicy } from "./managed.js";
|
|
9
|
-
import { MIN_CONTEXT_PIN,
|
|
9
|
+
import { MIN_CONTEXT_PIN, DEFAULT_ACTIVE_MODEL, GATEWAY_BASE, LOCAL_GATEWAY_BASE } from "../router/models.js";
|
|
10
10
|
import { LEGACY_API_HOST, PRODUCT_API_HOST } from "./product-hosts.js";
|
|
11
11
|
/** Resolve an endpoint's bearer from config/env/secret-file (first hit wins); undefined when none set
|
|
12
12
|
* (a local/un-gated endpoint). Keeps the raw key out of settings when `apiKeyEnv`/`apiKeyFile` are used. */
|
|
@@ -40,7 +40,7 @@ const DEFAULTS = {
|
|
|
40
40
|
// Fallback literal for hosts without a running operator-runtime gateway (mobile, browser, dev).
|
|
41
41
|
// Fleet nodes with ~/.operator/runtime/server.json dynamically override this at startup via the
|
|
42
42
|
// gateway-discovery path in cli.tsx — single source of truth, enterprise-safe for both postures.
|
|
43
|
-
aurora: { base: "http://127.0.0.1:8097", ctxWindow: 1000000, model: "aurora-code-1" },
|
|
43
|
+
aurora: { base: "http://127.0.0.1:8097", ctxWindow: 1000000, model: "aurora-code-1" }, // == DEFAULT_AURORA_ENDPOINT: buildEndpointChain puts the router's `main` before it
|
|
44
44
|
// No built-in standby: a deployment names its own in settings.json (endpoints.failover — same model and the
|
|
45
45
|
// same real window as the primary, so a failover holds a live session instead of truncating it).
|
|
46
46
|
},
|
|
@@ -67,7 +67,8 @@ const DEFAULTS = {
|
|
|
67
67
|
// harmlessly and the boot screen falls back to the manual hint (autostart is best-effort by design).
|
|
68
68
|
services: {
|
|
69
69
|
// co.0perator.* since 2026-10-28; legacyLabels keeps a box that still runs the old job self-healing.
|
|
70
|
-
|
|
70
|
+
// autostart OFF since 11/25: Aurora is retired behind the router (Kimi/Athena); a box that still serves it opts in.
|
|
71
|
+
aurora: { autostart: false, launchdLabel: "co.0perator.gateway", plistPath: "~/Library/LaunchAgents/co.0perator.gateway.plist", legacyLabels: ["ai.operator.gateway"], waitSec: 90 },
|
|
71
72
|
autopilot: { autostart: true, launchdLabel: "com.axe.autopilot", plistPath: "~/Library/LaunchAgents/com.axe.autopilot.plist", url: "http://127.0.0.1:9333" },
|
|
72
73
|
vision: { autostart: false, launchdLabel: "co.0perator.vision", plistPath: "~/Library/LaunchAgents/co.0perator.vision.plist", legacyLabels: ["axe.vision-bot"], url: "http://127.0.0.1:7788" },
|
|
73
74
|
stopOnExit: { searxng: true }, // aurora/autopilot are shared + never stopped; only the SearXNG container is
|
|
@@ -79,7 +80,7 @@ const DEFAULTS = {
|
|
|
79
80
|
planner: { id: "cortana", endpoint: GATEWAY_BASE, model: "cortana" },
|
|
80
81
|
specialist: { id: "gpt-oss-20b" },
|
|
81
82
|
},
|
|
82
|
-
activeModel:
|
|
83
|
+
activeModel: DEFAULT_ACTIVE_MODEL, // /model default for a fresh install: the router's operator-flash route (0.1.361; was the Aurora row)
|
|
83
84
|
// Autonomy: everything conservative. keepAwake off; dream OFF and read-mostly with a board-only
|
|
84
85
|
// allowlist. An interactive owner never touches any of this until they run an autonomy subcommand.
|
|
85
86
|
autonomy: {
|
|
@@ -158,6 +159,9 @@ function applyEnv(s) {
|
|
|
158
159
|
const acct = Number(process.env.KODE_AUTONOMY_CEILING_TOKENS); // higher ceiling for unattended headless/loop runs
|
|
159
160
|
if (Number.isFinite(acct))
|
|
160
161
|
out.compaction = { ...out.compaction, autonomyCeilingTokens: acct };
|
|
162
|
+
const mtps = process.env.KODE_COMPACT_MIN_TPS; // speed trigger: compact when sustained decode falls under N tok/s
|
|
163
|
+
if (mtps !== undefined && mtps !== "" && Number.isFinite(Number(mtps)))
|
|
164
|
+
out.compaction = { ...out.compaction, minDecodeTps: Number(mtps) };
|
|
161
165
|
const rcAuto = process.env.KODE_RC_AUTOSTART; // RC host auto-start on boot (opt-in)
|
|
162
166
|
if (rcAuto === "1" || rcAuto === "0")
|
|
163
167
|
out.remote = { ...out.remote, autostart: rcAuto === "1" };
|
|
@@ -260,6 +264,12 @@ export function compactionCeilingTokens(s, mode = "interactive") {
|
|
|
260
264
|
const explicit = mode === "autonomy" ? s.compaction?.autonomyCeilingTokens : s.compaction?.ceilingTokens;
|
|
261
265
|
return typeof explicit === "number" && Number.isFinite(explicit) && explicit >= 8000 ? Math.floor(explicit) : undefined;
|
|
262
266
|
}
|
|
267
|
+
/** The decode-rate floor (tok/s) for speed-aware compaction in this session mode (`compaction.minDecodeTps` /
|
|
268
|
+
* `compaction.autonomyMinDecodeTps`), or undefined (off). Each mode reads only its own key. */
|
|
269
|
+
export function compactionMinDecodeTps(s, mode = "interactive") {
|
|
270
|
+
const v = mode === "autonomy" ? s.compaction?.autonomyMinDecodeTps : s.compaction?.minDecodeTps;
|
|
271
|
+
return typeof v === "number" && Number.isFinite(v) && v > 0 ? v : undefined;
|
|
272
|
+
}
|
|
263
273
|
/** The per-turn WALL-CLOCK budget (ms) to hand runTurn — the only bound on TIME, the brake on hour-long turns.
|
|
264
274
|
* settings.autonomy.maxTurnWallClockSec, env KODE_TURN_MAX_WALLCLOCK_SEC wins; 0/unset ⇒ undefined (no cap).
|
|
265
275
|
* Resolved here so headless/autonomy (and any surface that opts in) read it identically. */
|
|
@@ -349,9 +359,16 @@ function resolveModelMode(s) {
|
|
|
349
359
|
// for an edge/zone failure of one name (config/product-hosts.ts). Opt out with
|
|
350
360
|
// `settings.endpoints.cloudFailover === false` for a sovereign deployment that must never egress.
|
|
351
361
|
const CLOUD_FAILOVERS = [
|
|
352
|
-
{ name: "operator-cloud", base: `https://${PRODUCT_API_HOST}`, model: "
|
|
353
|
-
{ name: "axe-cloud", base: `https://${LEGACY_API_HOST}`, model: "
|
|
362
|
+
{ name: "operator-cloud", base: `https://${PRODUCT_API_HOST}`, model: "main", ctxLimit: 307200, transport: "openai" },
|
|
363
|
+
{ name: "axe-cloud", base: `https://${LEGACY_API_HOST}`, model: "main", ctxLimit: 307200, transport: "openai" },
|
|
354
364
|
];
|
|
365
|
+
/** The shipped endpoints.aurora literal (DEFAULTS) — a box that never named its own primary. */
|
|
366
|
+
const DEFAULT_AURORA_ENDPOINT = { base: "http://127.0.0.1:8097", ctxWindow: 1000000, model: "aurora-code-1" };
|
|
367
|
+
function isDefaultAuroraLiteral(e) {
|
|
368
|
+
return e.base.replace(/\/+$/, "") === DEFAULT_AURORA_ENDPOINT.base && e.model === DEFAULT_AURORA_ENDPOINT.model && e.ctxWindow === DEFAULT_AURORA_ENDPOINT.ctxWindow;
|
|
369
|
+
}
|
|
370
|
+
/** The local router's `main` capability (the one door, loopback): the default primary when the owner named none. */
|
|
371
|
+
const ROUTER_MAIN = { name: "main", base: LOCAL_GATEWAY_BASE.replace(/\/v1\/?$/, ""), model: "main", ctxLimit: 262144 };
|
|
355
372
|
function hostLabel(base) {
|
|
356
373
|
try {
|
|
357
374
|
const u = new URL(base);
|
|
@@ -382,6 +399,10 @@ export function buildEndpointChain(s) {
|
|
|
382
399
|
seen.add(key);
|
|
383
400
|
chain.push(ep);
|
|
384
401
|
};
|
|
402
|
+
// 11/25: the built-in primary is the local router's `main` capability, not a launchd-owned Aurora. Only the shipped
|
|
403
|
+
// literal is demoted: an owner's own endpoints.aurora (or the gateway's discovered port) stays first.
|
|
404
|
+
if (isDefaultAuroraLiteral(aurora))
|
|
405
|
+
add({ ...ROUTER_MAIN });
|
|
385
406
|
add({ name: "operator-1m", base: aurora.base, model: aurora.model, ctxLimit: aurora.ctxWindow, token: resolveEndpointApiKey(aurora), loopbackAuth: true });
|
|
386
407
|
for (const base of (s.fleet?.auroraNodes ?? []).filter(Boolean)) {
|
|
387
408
|
const cfg = { base, model: aurora.model, ctxWindow: aurora.ctxWindow };
|
|
@@ -144,6 +144,10 @@ export function listLocalSkills() {
|
|
|
144
144
|
}
|
|
145
145
|
return [...byName.values()].sort((a, c) => a.name.localeCompare(c.name));
|
|
146
146
|
}
|
|
147
|
+
/** The installed skill a typed `/<name>` names: every local skill is also a slash command, as in Claude Code. */
|
|
148
|
+
export function skillCommand(name) {
|
|
149
|
+
return name ? listLocalSkills().find((s) => s.name === name)?.name : undefined;
|
|
150
|
+
}
|
|
147
151
|
export function resolveSkillFile(skillRoot, filePath) {
|
|
148
152
|
const b = nodeBuiltins();
|
|
149
153
|
if (!b || !filePath)
|
package/dist/config/toolchain.js
CHANGED
|
@@ -57,6 +57,19 @@ const realOrUndefined = (b, p) => { try {
|
|
|
57
57
|
catch {
|
|
58
58
|
return undefined;
|
|
59
59
|
} };
|
|
60
|
+
// The consumer link is the one another process flips (rename(2) over it). On macOS 26 a readlink racing that rename can
|
|
61
|
+
// fail with EINVAL for an instant; that one error is retried, every other error still fails closed.
|
|
62
|
+
const linkTarget = (b, p) => {
|
|
63
|
+
for (let i = 0;; i++) {
|
|
64
|
+
try {
|
|
65
|
+
return b.fs.realpathSync(p);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
if (e.code !== "EINVAL" || i >= 4)
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
60
73
|
const allowed = (b, p, mode) => { try {
|
|
61
74
|
b.fs.accessSync(p, mode);
|
|
62
75
|
return true;
|
|
@@ -84,7 +97,7 @@ export function resolveToolchainBin(bin, opts) {
|
|
|
84
97
|
if (!store)
|
|
85
98
|
throw new ToolchainError(`no store at ${b.path.join(home, "store")}`);
|
|
86
99
|
const consumer = b.path.join(home, "consumers", opts.consumer);
|
|
87
|
-
const gen =
|
|
100
|
+
const gen = linkTarget(b, consumer);
|
|
88
101
|
if (!gen)
|
|
89
102
|
throw new ToolchainError(`consumer ${opts.consumer} is not activated (${consumer} is missing or dangling)`);
|
|
90
103
|
const n = b.path.basename(gen);
|
package/dist/engine/aurora.js
CHANGED
|
@@ -279,6 +279,18 @@ export function shipsLlamaCacheKnobs(base, transport) {
|
|
|
279
279
|
return requiresOperatorToken(base);
|
|
280
280
|
return true;
|
|
281
281
|
}
|
|
282
|
+
let speculationOff = false;
|
|
283
|
+
/** Process-wide speculation default (GW-26), set once from settings at startup: false sends the ngram disable on every
|
|
284
|
+
* llama.cpp request that has no explicit enableSpeculation. */
|
|
285
|
+
export function setSpeculation(on) { speculationOff = !on; }
|
|
286
|
+
/** Settings then env (env wins): `KODE_SPECULATION=0` or `settings.speculation === false` turns it off. Default ON. */
|
|
287
|
+
export function speculationEnabled(s, env = process.env) {
|
|
288
|
+
if (env.KODE_SPECULATION === "0" || env.KODE_SPECULATION === "false")
|
|
289
|
+
return false;
|
|
290
|
+
if (env.KODE_SPECULATION === "1" || env.KODE_SPECULATION === "true")
|
|
291
|
+
return true;
|
|
292
|
+
return s.speculation !== false;
|
|
293
|
+
}
|
|
282
294
|
export function requestBody(messages, o, stream) {
|
|
283
295
|
// Transport dialect: llama.cpp-only fields ship to Aurora/fleet (default "llama") AND to our OWN
|
|
284
296
|
// vendor gateway (*.axe.onl — LiteLLM terminating at our llama.cpp, so the wire is OpenAI but the
|
|
@@ -311,16 +323,13 @@ export function requestBody(messages, o, stream) {
|
|
|
311
323
|
// fleet node that doesn't ship the full cache knobs still benefits — the progress chunks keep the idle-gap
|
|
312
324
|
// fed through a long cold prefill instead of looking wedged. A server that ignores the field is harmless.
|
|
313
325
|
...(stream && llama ? { return_progress: true } : {}),
|
|
314
|
-
// GW-26 (
|
|
315
|
-
//
|
|
316
|
-
//
|
|
317
|
-
//
|
|
318
|
-
//
|
|
319
|
-
//
|
|
320
|
-
|
|
321
|
-
// (GW-26 correction #9); re-verify upstream before touching AURORA_SPEC_TYPE. Explicit
|
|
322
|
-
// enableSpeculation true/false always wins over the tool-presence default.
|
|
323
|
-
...(cacheKnobs && (o.enableSpeculation === false || (o.enableSpeculation === undefined && (o.tools?.length ?? 0) > 0))
|
|
326
|
+
// GW-26 (2026-11-25): no per-request speculative field by default, tool rounds included — the server's
|
|
327
|
+
// --spec-type decides. ngram-mod drafts are verified by the target model, so the output is exact (Qwen3.8-27B,
|
|
328
|
+
// 6 prompts: identical sha256 with and without it; a code edit 11.1 → 52-56 tok/s). The old tool-round
|
|
329
|
+
// disable (sent on the belief that drafts fight the tool-call grammar) starved every agent round of that
|
|
330
|
+
// speed-up. Opt out with settings.speculation:false / KODE_SPECULATION=0 (setSpeculation), or per call with
|
|
331
|
+
// enableSpeculation:false; an explicit enableSpeculation always wins.
|
|
332
|
+
...(cacheKnobs && (o.enableSpeculation === false || (o.enableSpeculation === undefined && speculationOff))
|
|
324
333
|
? { speculative: { ngram: { enabled: false } } } : {}),
|
|
325
334
|
max_tokens: o.maxTokens ?? 8192, temperature: o.temperature ?? 0.7,
|
|
326
335
|
...(o.tools?.length ? { tools: o.tools, tool_choice: "auto", parallel_tool_calls: true } : {}),
|