@0perator/operator 0.1.340 → 0.1.341
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/config/settings.js +4 -3
- package/dist/engine/agent.js +30 -4
- package/dist/engine/moa.js +8 -0
- package/dist/router/models.js +1 -1
- package/dist/session.js +2 -2
- package/package.json +1 -1
package/dist/config/settings.js
CHANGED
|
@@ -75,12 +75,13 @@ const DEFAULTS = {
|
|
|
75
75
|
vision: { autostart: false, launchdLabel: "co.0perator.vision", plistPath: "~/Library/LaunchAgents/co.0perator.vision.plist", legacyLabels: ["axe.vision-bot"], url: "http://127.0.0.1:7788", remoteUrl: "http://192.168.1.103:8095" },
|
|
76
76
|
stopOnExit: { searxng: true }, // aurora/autopilot are shared + never stopped; only the SearXNG container is
|
|
77
77
|
},
|
|
78
|
-
// MOA (2026-10-
|
|
79
|
-
// 0perator gateway so every signed-in Operator has the same team.
|
|
78
|
+
// MOA (2026-10-30, James): gpt-oss-20b + Cortana propose, Cortana aggregates and reads images (its own vision
|
|
79
|
+
// projector) — both on JL1, reached through the 0perator gateway so every signed-in Operator has the same team.
|
|
80
|
+
// Was Dolphin 7B + Cortana (10/28). settings.moa replaces it wholesale.
|
|
80
81
|
moa: {
|
|
81
82
|
proposers: [
|
|
83
|
+
{ id: "gpt-oss-20b", endpoint: GATEWAY_BASE, model: "gpt-oss-20b" },
|
|
82
84
|
{ id: "cortana", endpoint: GATEWAY_BASE, model: "cortana" },
|
|
83
|
-
{ id: "dolphin-7b", endpoint: GATEWAY_BASE, model: "dolphin-7b" },
|
|
84
85
|
],
|
|
85
86
|
aggregator: { id: "cortana", endpoint: GATEWAY_BASE, model: "cortana" },
|
|
86
87
|
},
|
package/dist/engine/agent.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// text tool-call recovery (toolcalls.ts) and compaction (compaction.ts). Tools and routing are
|
|
3
3
|
// NOT implemented here — this file depends only on the two interfaces below, which the
|
|
4
4
|
// kode-tsi/src/tools/** + kode-tsi/src/router/** lane implements.
|
|
5
|
-
import { chat, endpointSlots } from "./aurora.js";
|
|
5
|
+
import { chat, endpointSlots, getOperatorToken, requiresOperatorToken } from "./aurora.js";
|
|
6
6
|
import { parseToolArgs } from "./json-repair.js";
|
|
7
7
|
import { buildMessages } from "./messages.js";
|
|
8
8
|
import { recoverToolCalls, cleanAssistantProse } from "./toolcalls.js";
|
|
@@ -540,6 +540,18 @@ function watchRepetition(opts, on) {
|
|
|
540
540
|
return w;
|
|
541
541
|
}
|
|
542
542
|
/** Runs one user turn to completion: compacts, loops model↔tools ≤maxRounds, self-heals, finalizes. */
|
|
543
|
+
/** A gateway 401/403 with the reason a person can act on: no token was loaded at all (signed out, or the keychain
|
|
544
|
+
* is locked — every SSH session on macOS), versus a token the gateway rejected. */
|
|
545
|
+
export function authError(err, base) {
|
|
546
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
547
|
+
if (!requiresOperatorToken(base))
|
|
548
|
+
return err instanceof Error ? err : new Error(msg);
|
|
549
|
+
const why = getOperatorToken()
|
|
550
|
+
? "the gateway rejected this Operator's sign-in token — run `operator auth login` to renew it"
|
|
551
|
+
: "no sign-in token was loaded — run `operator auth login`; over SSH the macOS keychain is locked, so unlock it " +
|
|
552
|
+
"(`security unlock-keychain`) first";
|
|
553
|
+
return new Error(`${msg}\n${why}; or set a failover endpoint that needs no token (settings endpoints.failover)`);
|
|
554
|
+
}
|
|
543
555
|
export async function runTurn(userInput, conversation, opts) {
|
|
544
556
|
const softRounds = opts.maxRounds ?? 10;
|
|
545
557
|
const absCeiling = Math.max(softRounds + 1, opts.maxRoundsHard ?? 400); // absolute safety stop; progress-aware below
|
|
@@ -660,6 +672,7 @@ export async function runTurn(userInput, conversation, opts) {
|
|
|
660
672
|
let promptTokensTotal = 0; // prompt tokens PREFILLED, summed across rounds
|
|
661
673
|
let promptMsTotal = 0; // prefill ms summed across rounds
|
|
662
674
|
let emptyRetries = 0; // reasoning models sometimes return a "dud" round (no content, no tool calls)
|
|
675
|
+
let authFailedOver = false; // one hop off a gateway that refused our credentials (see the auth branch)
|
|
663
676
|
let truncRetries = 0; // chunk-write nudges spent recovering a truncated-tool-call 500 (truncatedToolNudge)
|
|
664
677
|
let truncDispatched = 0; // cut-off calls let through to dispatch after the retry budget; a 2nd means the loop isn't converging → hand back
|
|
665
678
|
let loadingRetries = 0; // patient waits spent while an endpoint reports it's still (re)loading its model
|
|
@@ -916,9 +929,22 @@ export async function runTurn(userInput, conversation, opts) {
|
|
|
916
929
|
opts.onSelfHeal?.("server_error", 1); // footer ↻ — a recovery is in flight
|
|
917
930
|
continue;
|
|
918
931
|
}
|
|
919
|
-
//
|
|
920
|
-
//
|
|
921
|
-
|
|
932
|
+
// Bad credentials: resending to the same gateway never helps, but the owner's failover (a LAN or loopback
|
|
933
|
+
// model that needs no token) can still answer — JL1 over SSH has a locked keychain, so no token loads and
|
|
934
|
+
// the gateway says 401 while Cortana sits on localhost. One hop per turn; then fail with the cause.
|
|
935
|
+
if (recovery === "auth") {
|
|
936
|
+
const next = authFailedOver ? null : opts.router.recover(endpoint, "unavailable");
|
|
937
|
+
if (next) {
|
|
938
|
+
authFailedOver = true;
|
|
939
|
+
endpoint = next;
|
|
940
|
+
opts.onRoute?.(endpoint);
|
|
941
|
+
continue;
|
|
942
|
+
}
|
|
943
|
+
throw authError(err, endpoint.base);
|
|
944
|
+
}
|
|
945
|
+
// Non-retryable: a malformed request (a bad tool call) won't be fixed by resending — fail fast rather
|
|
946
|
+
// than spin (that futile-retry storm is what burned minutes).
|
|
947
|
+
if (recovery === "bad_request" || selfHealBudget <= 0)
|
|
922
948
|
throw err;
|
|
923
949
|
const attempt = MAX_SELF_HEAL_PER_TURN - selfHealBudget; // 0-based
|
|
924
950
|
selfHealBudget -= 1;
|
package/dist/engine/moa.js
CHANGED
|
@@ -48,4 +48,12 @@ export function labelDrafts(drafts) {
|
|
|
48
48
|
.map((d, i) => `Candidate ${String.fromCharCode(65 + i)} (${d.id}):\n${d.content}`)
|
|
49
49
|
.join("\n\n");
|
|
50
50
|
}
|
|
51
|
+
/** The team, as fact, for the aggregator. Without it the model guessed its own members from the fleet notes in the
|
|
52
|
+
* prompt (10/30: it named Aurora and the vision model while only Cortana had answered, Dolphin being down). */
|
|
53
|
+
export function teamLine(proposers, answered, aggregator) {
|
|
54
|
+
const missing = proposers.map((p) => p.id).filter((id) => !answered.includes(id));
|
|
55
|
+
return `This mixture's team: proposers ${proposers.map((p) => p.id).join(", ")}; aggregator ${aggregator}.` +
|
|
56
|
+
(missing.length ? ` Did not answer this turn: ${missing.join(", ")}.` : "") +
|
|
57
|
+
" Asked which models make up the mixture, name exactly these.";
|
|
58
|
+
}
|
|
51
59
|
export const DEFAULT_AGGREGATOR_PROMPT = "You are given candidate answers from several models. Synthesize the single best, correct, complete answer. Do not mention the candidates.";
|
package/dist/router/models.js
CHANGED
|
@@ -139,7 +139,7 @@ export const BUILTIN_MODELS = [
|
|
|
139
139
|
{ id: "axe-aurora-300k", tier: "power", label: "Aurora Code 1", params: "35B-A3B", box: "cloud", kind: "single", desc: "remote shared slot via api.0perator.co (api.axe.onl as fallback) — contended decode measured 1-4.6 tok/s vs local 24-47; cold >~100K prefills can hit the Cloudflare ~125s edge cutoff", endpoint: GATEWAY_BASE, endpoints: [GATEWAY_BASE, LEGACY_GATEWAY_BASE], model: "aurora-code-1", ctx: 307200, transport: "openai", hidden: true },
|
|
140
140
|
{ id: "operator-128k", tier: "economy", label: "Aurora Code 1", params: "35B-A3B", box: "JL2", kind: "single", desc: "128K context, lighter RAM (:8096) — slot not served on this fleet today; hidden from the picker, resolves by id when the slot comes up", endpoint: "http://127.0.0.1:8096/v1", model: "aurora-code-1", ctx: 131072, hidden: true },
|
|
141
141
|
// ── orchestrated ────────────────────────────────────────────────────────────────────────────────────────
|
|
142
|
-
{ id: "moa", tier: "power_turbo", label: "MOA", box: "mixture of agents", kind: "orchestrated", desc: "the team slot — each turn goes to
|
|
142
|
+
{ id: "moa", tier: "power_turbo", label: "MOA", box: "mixture of agents", kind: "orchestrated", desc: "the team slot — each turn goes to gpt-oss-20b + Cortana (JL1) through the 0perator gateway in parallel, then Cortana writes the answer and reads any images (settings.moa overrides)" },
|
|
143
143
|
];
|
|
144
144
|
export const OPERATOR_FREE_ACCOUNT = "0perator";
|
|
145
145
|
export const BYO_PRESETS = {
|
package/dist/session.js
CHANGED
|
@@ -13,7 +13,7 @@ import { engineRouter } from "./engine/router-adapter.js";
|
|
|
13
13
|
import { appendFileSync, mkdirSync } from "node:fs";
|
|
14
14
|
import { dirname } from "node:path";
|
|
15
15
|
import { operatorPath } from "./config/home.js";
|
|
16
|
-
import { fanOutProposers, labelDrafts, DEFAULT_AGGREGATOR_PROMPT } from "./engine/moa.js";
|
|
16
|
+
import { fanOutProposers, labelDrafts, teamLine, DEFAULT_AGGREGATOR_PROMPT } from "./engine/moa.js";
|
|
17
17
|
import { routeShadowTurn, shadowPrompt } from "./moa/shadow.js"; // MOA phase-0 observability (KODE_MOA_SHADOW)
|
|
18
18
|
import { AuroraRouter } from "./router/router.js";
|
|
19
19
|
import { operatorAgentPersona } from "./config/operator-harness.js";
|
|
@@ -1210,7 +1210,7 @@ export class Session {
|
|
|
1210
1210
|
const aggRouter = this.wrap(new AuroraRouter([
|
|
1211
1211
|
{ name: moa.aggregator.id, base: endpointBase(moa.aggregator.endpoint), model: moa.aggregator.model, ctxLimit: this.inner.ctxLimit() },
|
|
1212
1212
|
]));
|
|
1213
|
-
const aggSys = `${this.sysWithThink() ?? ""}\n\n## MOA aggregation\n${moa.aggregator_prompt ?? DEFAULT_AGGREGATOR_PROMPT}\n\n${labelDrafts(drafts)}`;
|
|
1213
|
+
const aggSys = `${this.sysWithThink() ?? ""}\n\n## MOA aggregation\n${moa.aggregator_prompt ?? DEFAULT_AGGREGATOR_PROMPT}\n${teamLine(moa.proposers, survivors.map((d) => d.id), moa.aggregator.id)}\n\n${labelDrafts(drafts)}`;
|
|
1214
1214
|
return this.execute(text, h, aggRouter, aggSys, moa.aggregator.id);
|
|
1215
1215
|
}
|
|
1216
1216
|
/** Fire scout (settings.fastStart) with a bounded, independent timeout — never the real turn's own
|