@0perator/operator 0.1.360-next.1 → 0.2.0
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 +1 -1
- package/dist/autonomy/delegate-mode.js +159 -0
- package/dist/autonomy/delegate.js +1 -1
- package/dist/autonomy/session-factory.js +8 -2
- package/dist/background/index.js +26 -2
- package/dist/background/resume.js +125 -0
- package/dist/browser/engine.js +163 -0
- package/dist/browser/session.js +172 -134
- package/dist/cli.js +261 -70
- package/dist/config/settings.js +28 -7
- package/dist/config/skills-index.js +4 -0
- package/dist/engine/agent.js +1 -1
- package/dist/engine/aurora.js +22 -13
- package/dist/engine/compaction.js +1 -1
- package/dist/engine/moa.js +2 -1
- package/dist/engine/selfheal.js +1 -1
- package/dist/engine/speed-compaction.js +37 -0
- package/dist/engine/toolcalls.js +6 -6
- package/dist/gateway-cli.js +14 -5
- package/dist/index.js +3 -0
- package/dist/mcp/phone-server.js +30 -0
- package/dist/permissions/index.js +33 -17
- package/dist/permissions/signature.js +5 -0
- package/dist/phone-cli.js +65 -0
- package/dist/remote/host.js +31 -2
- package/dist/router/models.js +49 -25
- package/dist/selfimprove/index.js +1 -1
- package/dist/services/preflight.js +31 -8
- package/dist/session.js +96 -14
- package/dist/tools/deferred.js +1 -0
- package/dist/tools/device/android.js +227 -0
- package/dist/tools/device/classify.js +127 -0
- package/dist/tools/device/deps.js +69 -0
- package/dist/tools/device/desktop.js +82 -0
- package/dist/tools/device/harness.js +262 -0
- package/dist/tools/device/iphone.js +206 -0
- package/dist/tools/device/mirroring-jxa.js +146 -0
- package/dist/tools/device/setup.js +90 -0
- package/dist/tools/device/tools.js +70 -0
- package/dist/tools/device/types.js +19 -0
- package/dist/tools/registry.js +242 -48
- package/dist/tools/vision-media.js +162 -0
- package/dist/ui/App.js +4 -3
- package/dist/ui/ApprovalPrompt.js +10 -4
- package/dist/ui/BgPanel.js +2 -2
- package/dist/ui/UpdatePrompt.js +40 -0
- package/dist/ui/modelPicker.js +26 -8
- package/dist/ui/slashCommands.js +1 -0
- package/dist/update-check.js +134 -0
- package/dist/update.js +82 -13
- package/dist/util/slash.js +2 -2
- package/package.json +4 -2
- package/src/tools/device/NOTICE +37 -0
- package/dist/browser/cdp.js +0 -271
package/dist/cli.js
CHANGED
|
@@ -13,8 +13,8 @@ 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";
|
|
17
|
-
import { RemoteHost } from "./remote/host.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
|
+
import { RemoteHost, toRemoteAgents } 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";
|
|
20
20
|
import { qrToTerminal } from "./ui/qr.js";
|
|
@@ -35,11 +35,12 @@ 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 {
|
|
42
|
+
import { clearResumable, pickUpSaved, quitSummary, resumeOnReopen, saveResumable, startSaved } from "./background/resume.js";
|
|
43
|
+
import { loadSettings, saveSettings, compactionThreshold, compactionCeilingTokens, compactionMinDecodeTps, rcAutostart, eagerAuthAtBoot, applySeat, setActiveSeat, buildEndpointChain, parseContextArg, nextContextPin } from "./config/settings.js";
|
|
43
44
|
import { resolveSeat } from "./auth/identity.js";
|
|
44
45
|
import { PermissionPolicy } from "./permissions/index.js";
|
|
45
46
|
import { caps } from "./ui/capabilities.js";
|
|
@@ -47,12 +48,13 @@ import { composeSystemPrompt, appendMemory, subagentSystemPrompt } from "./confi
|
|
|
47
48
|
import { SUBAGENT_ROLES, SUBAGENT_TOOL_DENY, roleCanWrite } from "./engine/grandmaster.js";
|
|
48
49
|
import { applyToolsBinPath, operatorPath } from "./config/home.js";
|
|
49
50
|
import { ensureOperatorHome } from "./config/scaffold.js";
|
|
50
|
-
import { listLocalSkills } from "./config/skills-index.js";
|
|
51
|
+
import { listLocalSkills, skillCommand } from "./config/skills-index.js";
|
|
51
52
|
import { modelCtxFor, leanHarnessFor, selectModel, modelRegistry, fmtCtx, shortName, BYO_PRESETS, DEFAULT_MODEL_ID } from "./router/models.js";
|
|
52
53
|
import { fetchPortalModels, offlineNote, portalIdFor } from "./router/portal.js";
|
|
53
54
|
import { fetchFreeModels } from "./router/free-models.js";
|
|
54
55
|
import { describeTurnError } from "./engine/net-error.js";
|
|
55
56
|
import { fallbackNotice, primaryRecoveredLine, recoveryLine } from "./engine/continuation.js";
|
|
57
|
+
import { speedCompactionLine } from "./engine/speed-compaction.js";
|
|
56
58
|
import { hasByoToken, setByoToken } from "./auth/byo.js";
|
|
57
59
|
import { getDiscoveredModels } from "./router/discovery.js";
|
|
58
60
|
import { disposeShellSession, getAgentTasks, registry } from "./tools/registry.js";
|
|
@@ -80,6 +82,7 @@ import { isFeatureEnabled } from "./config/features.js";
|
|
|
80
82
|
import { classifyActVsAsk, actAskGateDirective } from "./engine/classifier.js";
|
|
81
83
|
import { resolveMode } from "./classifier/modes.js";
|
|
82
84
|
import { subagentModelFor, servingModelFor } from "./autonomy/subagent-model.js";
|
|
85
|
+
import { parseDelegate, delegateStatusLines, delegateGuardOn, setDelegateSettings } from "./autonomy/delegate-mode.js";
|
|
83
86
|
import { classifierConfig } from "./classifier/config.js";
|
|
84
87
|
import { throttle } from "./util/throttle.js";
|
|
85
88
|
import { isSlashCommand } from "./util/slash.js";
|
|
@@ -155,12 +158,14 @@ if (process.argv[2] === "selfimprove") {
|
|
|
155
158
|
}
|
|
156
159
|
// operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
|
|
157
160
|
const settings = loadSettings();
|
|
161
|
+
setDelegateSettings(settings.delegate); // delegate mode's guard, read per tool call by every session in this process
|
|
158
162
|
// Enterprise first-run: make the operator home's contract explicit BEFORE any module writes into it (0700
|
|
159
163
|
// root, ignore-everything .gitignore, README, settings.example.json, home.json). Idempotent, never throws.
|
|
160
164
|
const HOME_SCAFFOLD = ensureOperatorHome({ version: VERSION });
|
|
161
165
|
// Bridge the resolved (managed + contextual-floor) sandbox mode to the tool layer: sandboxMode() reads
|
|
162
166
|
// KODE_SANDBOX at exec time, so a settings/managed "strict" that is never bridged would run unconfined.
|
|
163
167
|
applySandboxMode(settings.sandbox.mode);
|
|
168
|
+
setSpeculation(speculationEnabled(settings)); // GW-26: settings.speculation:false / KODE_SPECULATION=0 restore the per-request ngram disable
|
|
164
169
|
// operator-home-v2 phase 5: the managed owner-CLI toolkit is a SINGLE PATH addition
|
|
165
170
|
// ($KODE_HOME/tools/bin, materialized by operator-home/tools/toolkit-verify.sh). Projected once at
|
|
166
171
|
// startup so every child inherits it — persistent bash, exec-file tools, in-process cron sessions.
|
|
@@ -260,7 +265,7 @@ if (firstRunEligible) {
|
|
|
260
265
|
// Seat resolution (enterprise SSO/RBAC readiness): with a managed auth policy deployed, the verified identity
|
|
261
266
|
// decides the widest tier this process may hold (it can only NARROW, never widen). With no managed policy this
|
|
262
267
|
// is a no-op and touches no network. `operator auth …` / --version / --help skip it (they must work signed-out).
|
|
263
|
-
const SKIP_SEAT = process.argv[2] === "auth" || process.argv[2] === "audit" || process.argv[2] === "gateway" || process.argv[2] === "toolchain" || process.argv.includes("--version") || process.argv.includes("-V") || process.argv.includes("--help");
|
|
268
|
+
const SKIP_SEAT = process.argv[2] === "auth" || process.argv[2] === "audit" || process.argv[2] === "gateway" || process.argv[2] === "toolchain" || process.argv[2] === "phone" || process.argv.includes("--version") || process.argv.includes("-V") || process.argv.includes("--help");
|
|
264
269
|
const SEAT = SKIP_SEAT
|
|
265
270
|
? { seat: { tier: settings.permissions.tier ?? "admin", source: "local-owner", reasons: ["seat resolution skipped for this command"] }, events: [], dropToken: false }
|
|
266
271
|
: await resolveSeat(settings, { creds: bootCreds });
|
|
@@ -302,10 +307,15 @@ if (settings.computer.enabled) {
|
|
|
302
307
|
// Foreground: computer_* and chauffeur ACTIONS prompt ("ask"); chauffeur READS (list_windows,
|
|
303
308
|
// get_window_state, …) are intentionally NOT gated, so the model reads the screen freely and completes
|
|
304
309
|
// a task end-to-end without walking the owner through each step. Only real input/mutation asks.
|
|
305
|
-
|
|
310
|
+
// The device tools (phone_*: iPhone via iPhone Mirroring, Android via adb, the desktop) are the same class: their
|
|
311
|
+
// actions ask like computer_*, their reads run unprompted like chauffeur's, and a background agent gets none of them.
|
|
312
|
+
const { PHONE_TOOLS, PHONE_TOOL_NAMES, PHONE_ACTION_NAMES } = await import("./tools/device/tools.js");
|
|
313
|
+
for (const t of PHONE_TOOLS)
|
|
314
|
+
registry.set(t.name, t);
|
|
315
|
+
const askNames = [...COMPUTER_TOOL_NAMES, ...PHONE_ACTION_NAMES, ...(chauffeurServer ? CHAUFFEUR_ACTION_NAMES : [])];
|
|
306
316
|
computerAskRules = Object.fromEntries(askNames.map((n) => [n, "ask"]));
|
|
307
317
|
// Background sub-agents have no approver, so DENY every embodiment tool, reads included.
|
|
308
|
-
const denyNames = [...COMPUTER_TOOL_NAMES, "desktop_screenshot", "desktop_read", ...(chauffeurServer ? CHAUFFEUR_TOOL_NAMES : [])];
|
|
318
|
+
const denyNames = [...COMPUTER_TOOL_NAMES, ...PHONE_TOOL_NAMES, "desktop_screenshot", "desktop_read", ...(chauffeurServer ? CHAUFFEUR_TOOL_NAMES : [])];
|
|
309
319
|
computerDenyRules = Object.fromEntries(denyNames.map((n) => [n, "deny"]));
|
|
310
320
|
}
|
|
311
321
|
// STANDARD MCP: report-mcp (PDF tools) ships with Operator — always injected, even without the full-fleet
|
|
@@ -466,6 +476,11 @@ installProcessTeardown(teardown, {
|
|
|
466
476
|
});
|
|
467
477
|
// Children a previous Operator left behind (it crashed, or was killed -9; detached shells/jobs and Chrome outlive their parent).
|
|
468
478
|
let REAPED = { owners: 0, killed: [], skipped: 0 };
|
|
479
|
+
// The update-available check (update-check.ts): started just before the TUI mounts, never awaited by the boot. "Update now"
|
|
480
|
+
// parks the offer in UPDATE_NOW and closes the TUI; the update runs after the teardown, in the plain terminal.
|
|
481
|
+
let UPDATE_CHECK = Promise.resolve(null);
|
|
482
|
+
let UPDATE_ASKED_AT = 0;
|
|
483
|
+
let UPDATE_NOW = null;
|
|
469
484
|
// Build the endpoint router. ONE model now: Aurora at its native 1M context on :8097 — both `operator`
|
|
470
485
|
// and `operator+` serve the same single tier (the air/1m/saddle roster collapsed once Aurora ran true
|
|
471
486
|
// 1,048,576-token context at full speed). No size-based routing decision remains.
|
|
@@ -584,7 +599,9 @@ const HELP = [
|
|
|
584
599
|
" /remember <note> store a note to recall in future sessions",
|
|
585
600
|
" /memory [query] show remembered notes (all, or matching query)",
|
|
586
601
|
" /allow <tool:args> auto-allow a tool+args glob pattern in gated mode (e.g. bash:npm test*)",
|
|
602
|
+
" /delegate any /model id as the MoA planner or the sub-agents, plus a guard (no push, deploys or writes outside this repo)",
|
|
587
603
|
" /skill <name|off> activate a skill as a system-prompt directive (/skill off to deactivate)",
|
|
604
|
+
" /<skill> [message] any installed skill is its own command; the rest of the line is your first message",
|
|
588
605
|
" /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
606
|
" /login · /logout · /whoami /login opens the browser to approve; or /login <email> for a 6-digit code (then /login <code>); /login <token>",
|
|
590
607
|
" /agents [id] detailed sub-agent status, or /agents <id> for a deep view + controls (msg/stop/report)",
|
|
@@ -736,6 +753,7 @@ function Root() {
|
|
|
736
753
|
const [planExitPicker, setPlanExitPicker] = useState(null);
|
|
737
754
|
const [artifactsPicker, setArtifactsPicker] = useState(null);
|
|
738
755
|
const [sessionsPicker, setSessionsPicker] = useState(null);
|
|
756
|
+
const [updatePrompt, setUpdatePrompt] = useState(null);
|
|
739
757
|
const [finder, setFinder] = useState(null); // ctrl+g — the skills and tools finder
|
|
740
758
|
const alwaysAllowRef = useRef(new Set());
|
|
741
759
|
// Remembers the email a `/login <email>` sent a 6-digit code to, so the follow-up `/login <code>`
|
|
@@ -754,18 +772,18 @@ function Root() {
|
|
|
754
772
|
pendingApprovals.current.delete(id);
|
|
755
773
|
resolve(allow);
|
|
756
774
|
setApproval((cur) => {
|
|
757
|
-
if (cur && cur.id === id && allow && always)
|
|
775
|
+
if (cur && cur.id === id && allow && always && !cur.ctx?.once)
|
|
758
776
|
alwaysAllowRef.current.add(cur.name);
|
|
759
777
|
return cur && cur.id === id ? null : cur;
|
|
760
778
|
});
|
|
761
779
|
}, []);
|
|
762
|
-
const approveFn = useCallback((name, args) => {
|
|
763
|
-
if (alwaysAllowRef.current.has(name))
|
|
764
|
-
return Promise.resolve(true);
|
|
780
|
+
const approveFn = useCallback((name, args, ctx) => {
|
|
781
|
+
if (!ctx?.once && alwaysAllowRef.current.has(name))
|
|
782
|
+
return Promise.resolve(true); // a phone signature line asks every time
|
|
765
783
|
const id = "ap_" + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
766
784
|
return new Promise((resolve) => {
|
|
767
785
|
pendingApprovals.current.set(id, resolve);
|
|
768
|
-
setApproval({ id, name, args, resolve: (b) => settleApproval(id, b) });
|
|
786
|
+
setApproval({ id, name, args, ...(ctx ? { ctx } : {}), resolve: (b) => settleApproval(id, b) });
|
|
769
787
|
remoteRef.current?.approvalRequest(id, name, args); // mirror to followers (owner-scoped)
|
|
770
788
|
});
|
|
771
789
|
}, [settleApproval]);
|
|
@@ -783,7 +801,7 @@ function Root() {
|
|
|
783
801
|
auroraHookRef.current = auroraOnDemand(settings.endpoints.aurora, settings.services?.aurora, buildRouter, () => {
|
|
784
802
|
push({ kind: "message", message: { id: nextId(), role: "system", content: "aurora is not loaded — loading it for this turn…" } });
|
|
785
803
|
setPhase("loading");
|
|
786
|
-
});
|
|
804
|
+
}, (line) => push({ kind: "message", message: { id: nextId(), role: "system", content: line } }));
|
|
787
805
|
}
|
|
788
806
|
return auroraHookRef.current(signal);
|
|
789
807
|
};
|
|
@@ -807,6 +825,7 @@ function Root() {
|
|
|
807
825
|
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
826
|
compactionThreshold: compactionThreshold(settings), // settings.compaction.threshold / KODE_COMPACTION_THRESHOLD; undefined → derived from the served window
|
|
809
827
|
compactionCeilingTokens: compactionCeilingTokens(settings, "interactive"), // the owner's compaction.ceilingTokens / env, else no ceiling. Headless autonomy reads its own (session-factory.ts)
|
|
828
|
+
compactionMinDecodeTps: compactionMinDecodeTps(settings, "interactive"), // compaction.minDecodeTps / KODE_COMPACT_MIN_TPS: compact when sustained decode falls under it; undefined → off
|
|
810
829
|
temperature: settings.temperature,
|
|
811
830
|
recall: settings.memory.recall,
|
|
812
831
|
models: MERGED_MODELS, // discovered fleet nodes + settings.models overrides (built-ins in router/models.ts)
|
|
@@ -817,6 +836,7 @@ function Root() {
|
|
|
817
836
|
frontDoor: settings.frontDoor, // the gateway answers a message that needs no tools in the session's voice (engine/front-door.ts)
|
|
818
837
|
features: settings.features, // feature flags — registers flag-gated tools (e.g. cloudAgents) only when on
|
|
819
838
|
activeModel: settings.activeModel, // persisted /model choice, applied at startup
|
|
839
|
+
fallbackModel: settings.fallbackModel, // what answers a turn whose model failed on every leg; undefined → the router's `main`
|
|
820
840
|
contextPin: settings.contextPin, // persisted /context · ctrl+x choice (KODE_CONTEXT wins); unset = the served window
|
|
821
841
|
contextFloor: settings.contextFloor,
|
|
822
842
|
permissions: START_POLICY.permissions, // the starting mode's policy (Autonomous, or Gated when the settings say so)
|
|
@@ -1155,10 +1175,10 @@ function Root() {
|
|
|
1155
1175
|
// session on another model (moa, cortana) never needs it.
|
|
1156
1176
|
const primaryOk = reports.find((r) => r.name === "aurora")?.state === "idle" || (await session.health().catch(() => false));
|
|
1157
1177
|
// 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
|
-
|
|
1178
|
+
// through to it on the first turn (a new user's machine has only the cloud tier). The Aurora row's legs are the
|
|
1179
|
+
// shell chain; any other gateway row (operator-flash, the fresh-install default) has its own public leg.
|
|
1180
|
+
const laterLegs = session.currentModel() === DEFAULT_MODEL_ID ? buildEndpointChain(settings).map((e) => e.base) : session.endpoints().map((e) => e.base);
|
|
1181
|
+
const ok = primaryOk || (await anyReachable(laterLegs.slice(1)).catch(() => false));
|
|
1162
1182
|
setBoot(ok ? "ready" : "down");
|
|
1163
1183
|
if (!ok) {
|
|
1164
1184
|
const a = reports.find((r) => r.name === "aurora");
|
|
@@ -1468,6 +1488,7 @@ function Root() {
|
|
|
1468
1488
|
if (!compactRef.current)
|
|
1469
1489
|
setPhase("sent");
|
|
1470
1490
|
},
|
|
1491
|
+
onSpeedCompaction: (e) => sys(speedCompactionLine(e)),
|
|
1471
1492
|
onCompactionStart: ({ before }) => {
|
|
1472
1493
|
compactRef.current = { before, startedAt: Date.now(), ring: [], wrote: 0 };
|
|
1473
1494
|
setStepLabel("compacting context");
|
|
@@ -1988,12 +2009,61 @@ function Root() {
|
|
|
1988
2009
|
teardown.add("caffeinate", () => { setCaffeine(false); }, { order: 25 });
|
|
1989
2010
|
return () => { setCaffeine(false); };
|
|
1990
2011
|
}, [boot, setCaffeine]);
|
|
2012
|
+
// Agents still working when Operator closes are saved on the way out and picked back up by the next session in this folder
|
|
2013
|
+
// (background/resume.ts; settings.agents.resumeOnReopen). With the setting off they wait in /agents as paused.
|
|
2014
|
+
const pausedRef = useRef([]);
|
|
2015
|
+
const spawnSaved = (a) => !!bgRef.current?.spawn(a.task, a.role, a.name, a);
|
|
2016
|
+
useEffect(() => {
|
|
2017
|
+
if (boot !== "ready")
|
|
2018
|
+
return;
|
|
2019
|
+
const cwd = process.cwd();
|
|
2020
|
+
teardown.add("agents-resume", () => {
|
|
2021
|
+
const live = bgRef.current?.resumable(cwd, getAgentTasks()) ?? [];
|
|
2022
|
+
if (!live.length && !pausedRef.current.length)
|
|
2023
|
+
return;
|
|
2024
|
+
saveResumable(cwd, [...pausedRef.current, ...live]);
|
|
2025
|
+
if (live.length)
|
|
2026
|
+
process.stdout.write(`${quitSummary(live, resumeOnReopen(settings)).line}\n`);
|
|
2027
|
+
}, { order: 25 }); // before "background-agents" (30) interrupts them
|
|
2028
|
+
const picked = pickUpSaved(cwd, settings, spawnSaved, (m) => sys(`⚠ ${m}`));
|
|
2029
|
+
pausedRef.current = picked.paused;
|
|
2030
|
+
if (picked.line)
|
|
2031
|
+
sys(picked.line);
|
|
2032
|
+
}, [boot]);
|
|
2033
|
+
useEffect(() => { remoteRef.current?.setAgents(toRemoteAgents(bgAgents)); }, [bgAgents, rcActive]);
|
|
1991
2034
|
// Say so when this launch cleaned up after a previous one — silently killing processes would be worse than the orphans.
|
|
1992
2035
|
useEffect(() => {
|
|
1993
2036
|
const n = REAPED.killed.length;
|
|
1994
2037
|
if (n)
|
|
1995
2038
|
sys(`cleaned up ${n} leftover process${n === 1 ? "" : "es"} from a previous session that did not exit cleanly (${[...new Set(REAPED.killed.map((k) => k.label))].join(", ")}).`);
|
|
1996
2039
|
}, []);
|
|
2040
|
+
// A newer build (update-check.ts): the prompt before the first turn; once the owner has typed or a turn runs, one line.
|
|
2041
|
+
useEffect(() => {
|
|
2042
|
+
void UPDATE_CHECK.then((offer) => {
|
|
2043
|
+
if (!offer)
|
|
2044
|
+
return;
|
|
2045
|
+
if (idleLastActiveAt() > UPDATE_ASKED_AT || statusRef.current !== "idle") {
|
|
2046
|
+
sys(`Update available · ${offer.current} → ${offer.version} · run \`${offer.command}\` (release notes: ${offer.notes})`);
|
|
2047
|
+
return;
|
|
2048
|
+
}
|
|
2049
|
+
setUpdatePrompt({
|
|
2050
|
+
current: offer.current, version: offer.version, notes: offer.notes, command: offer.command,
|
|
2051
|
+
resolve: (choice) => {
|
|
2052
|
+
setUpdatePrompt(null);
|
|
2053
|
+
if (choice === "update") {
|
|
2054
|
+
UPDATE_NOW = offer;
|
|
2055
|
+
void teardown.run("quit");
|
|
2056
|
+
exit();
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
if (choice === "skip-version") {
|
|
2060
|
+
void import("./update-check.js").then(({ skipVersion }) => skipVersion(offer.version));
|
|
2061
|
+
sys(`Skipped ${offer.version} · Operator asks again when a newer version is out`);
|
|
2062
|
+
}
|
|
2063
|
+
},
|
|
2064
|
+
});
|
|
2065
|
+
});
|
|
2066
|
+
}, []);
|
|
1997
2067
|
// The actual mode switch — policy, plan flag, status badge, and follower-facing capabilities, all in
|
|
1998
2068
|
// lockstep. Factored out of applyMode so the plan-exit picker below can perform it from a resolve
|
|
1999
2069
|
// callback without re-entering (and re-gating) applyMode itself.
|
|
@@ -2211,57 +2281,71 @@ function Root() {
|
|
|
2211
2281
|
askKey(a.entry); });
|
|
2212
2282
|
};
|
|
2213
2283
|
const active = s.currentModel();
|
|
2214
|
-
|
|
2215
|
-
const
|
|
2216
|
-
|
|
2284
|
+
// Two screens (0.1.361): the main rows + "More models…", which opens every other row and the connect action.
|
|
2285
|
+
const view = (more) => {
|
|
2286
|
+
const o = { active, servedCtx: s.servedContext(), staleFree: freeStaleRef.current, cost: (m) => costOf(m.id), cols: termCols() };
|
|
2287
|
+
return more ? modelPickerView(s.modelRegistry().filter((m) => !isMainModel(m)), o) : mainPickerView(s.modelRegistry(), o);
|
|
2288
|
+
};
|
|
2217
2289
|
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")
|
|
2290
|
+
let refresh = () => { };
|
|
2291
|
+
const show = (more) => {
|
|
2292
|
+
const first = view(more);
|
|
2293
|
+
let onScreen = first.rows;
|
|
2294
|
+
const redraw = openPicker(more ? "More models" : "Select a model", first.rows, first.entries, (a) => {
|
|
2295
|
+
if ("typed" in a) {
|
|
2296
|
+
apply(a.typed);
|
|
2297
|
+
return;
|
|
2298
|
+
} // the typed-id escape: an explicit id skips the context step
|
|
2299
|
+
if (a.entry.kind === "more") {
|
|
2300
|
+
show(true);
|
|
2301
|
+
return;
|
|
2302
|
+
}
|
|
2303
|
+
if (a.entry.kind === "connect") {
|
|
2304
|
+
connectProvider();
|
|
2305
|
+
return;
|
|
2306
|
+
}
|
|
2307
|
+
const id = a.entry.profile.id;
|
|
2308
|
+
const go = () => { const chosen = apply(id); if (chosen && wantsContextStep(chosen, s.servedContext()))
|
|
2309
|
+
openContextPicker(); };
|
|
2310
|
+
// A pick that costs a long re-read asks once, with the price: switch now, compact here first, or stay.
|
|
2311
|
+
const cost = costOf(id);
|
|
2312
|
+
if (!cost || !wantsRereadConfirm(cost)) {
|
|
2246
2313
|
go();
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2314
|
+
return;
|
|
2315
|
+
}
|
|
2316
|
+
const here = s.currentModel() === DEFAULT_MODEL_ID ? "aurora" : s.currentModel();
|
|
2317
|
+
const est = s.compactionEstimate();
|
|
2318
|
+
const v = rereadConfirmView({
|
|
2319
|
+
target: a.entry.profile.label, current: here, cost,
|
|
2320
|
+
compact: est ? { afterMax: est.afterMax, summaryMax: est.summaryMax, decode: readRates.decodeRate(s.currentModel()) } : undefined,
|
|
2321
|
+
});
|
|
2322
|
+
openPicker(v.question, v.rows, v.choices, (c) => {
|
|
2323
|
+
if (!("entry" in c))
|
|
2324
|
+
return; // Esc / "chat about it": nothing changes
|
|
2325
|
+
if (c.entry === "switch")
|
|
2326
|
+
go();
|
|
2327
|
+
else if (c.entry === "compact") {
|
|
2328
|
+
flow.afterCompaction(go);
|
|
2329
|
+
void slashRef.current("/compact");
|
|
2330
|
+
} // compacts on the cache-warm model, then switches — before anything waiting can start a turn
|
|
2331
|
+
else
|
|
2332
|
+
sys(`stayed on ${here}`);
|
|
2333
|
+
});
|
|
2253
2334
|
});
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2335
|
+
// Live state markers from the portal and the free rows: the picker opens instantly; whichever lands re-renders
|
|
2336
|
+
// the picker on screen (markers on the same rows, free rows in their place before MOA) — only when something changed.
|
|
2337
|
+
refresh = () => {
|
|
2338
|
+
const v = view(more);
|
|
2339
|
+
const rows = markModelRows(v, cat);
|
|
2340
|
+
if (rows.length === onScreen.length && rows.every((t, i) => t === onScreen[i]))
|
|
2341
|
+
return;
|
|
2342
|
+
onScreen = rows;
|
|
2343
|
+
redraw(rows, v.entries);
|
|
2344
|
+
};
|
|
2345
|
+
if (cat)
|
|
2346
|
+
refresh();
|
|
2264
2347
|
};
|
|
2348
|
+
show(false);
|
|
2265
2349
|
void fetchPortalModels().then((c) => { if (c) {
|
|
2266
2350
|
cat = c;
|
|
2267
2351
|
refresh();
|
|
@@ -2763,6 +2847,64 @@ function Root() {
|
|
|
2763
2847
|
void sendTurn(`Use the deep_research tool to research this thoroughly and give me a cited, multi-source brief: ${arg}`);
|
|
2764
2848
|
break;
|
|
2765
2849
|
}
|
|
2850
|
+
case "delegate": {
|
|
2851
|
+
// Writes only existing settings (moa.plannerModel + moa.specialist, autonomy.subagentModel, delegate.*), in memory
|
|
2852
|
+
// and on disk: sub-agents resolve their model per spawn, delegate_task re-reads settings, the guard reads per call.
|
|
2853
|
+
const a = parseDelegate(arg);
|
|
2854
|
+
const setGuard = (patch) => {
|
|
2855
|
+
settings.delegate = { ...settings.delegate, ...patch };
|
|
2856
|
+
setDelegateSettings(settings.delegate);
|
|
2857
|
+
saveSettings({ delegate: patch });
|
|
2858
|
+
};
|
|
2859
|
+
const status = () => {
|
|
2860
|
+
const team = s.moaTeam();
|
|
2861
|
+
const d = settings.delegate ?? {};
|
|
2862
|
+
return delegateStatusLines({ activeModel: s.currentModel(), plannerModel: settings.moa?.plannerModel?.trim() ? team?.planner.id : undefined, specialist: team?.specialist, subagentModel: subagentModel(), guard: delegateGuardOn(process.env, d), allowPush: !!d.allowPush, repos: d.repos ?? [] }).join("\n");
|
|
2863
|
+
};
|
|
2864
|
+
if (a.kind === "error") {
|
|
2865
|
+
sys(a.message);
|
|
2866
|
+
break;
|
|
2867
|
+
}
|
|
2868
|
+
if (a.kind === "planner") {
|
|
2869
|
+
const executor = a.executor ?? (settings.moa?.specialist?.id ? undefined : subagentModelFor({ autonomy: settings.autonomy }));
|
|
2870
|
+
const r = s.setMoaPlanner(a.model, executor);
|
|
2871
|
+
if (!r.ok) {
|
|
2872
|
+
sys(`delegate planner: ${r.error}`);
|
|
2873
|
+
break;
|
|
2874
|
+
}
|
|
2875
|
+
const patch = { plannerModel: a.model, ...(executor ? { specialist: { id: executor } } : {}) };
|
|
2876
|
+
settings.moa = { ...settings.moa, ...patch };
|
|
2877
|
+
saveSettings({ moa: patch });
|
|
2878
|
+
const onMoa = s.currentModel() === "moa";
|
|
2879
|
+
sys(`delegate · planner ${a.model} → executor ${s.moaTeam()?.specialist}${onMoa ? (turnRunning() ? " · from the next turn" : "") : " · switching to /model moa"}`);
|
|
2880
|
+
if (!onMoa)
|
|
2881
|
+
submitRef.current("/model moa");
|
|
2882
|
+
break;
|
|
2883
|
+
}
|
|
2884
|
+
if (a.kind === "subagents") {
|
|
2885
|
+
const { profile, error } = selectModel(s.modelRegistry(), a.model, hasByoToken);
|
|
2886
|
+
if (!profile) {
|
|
2887
|
+
sys(`delegate subagents: ${error}`);
|
|
2888
|
+
break;
|
|
2889
|
+
}
|
|
2890
|
+
settings.autonomy = { ...settings.autonomy, subagentModel: a.model };
|
|
2891
|
+
saveSettings({ autonomy: { subagentModel: a.model } });
|
|
2892
|
+
sys(`delegate · sub-agents (spawn_agent, delegate_task default) run on ${a.model}${s.currentModel() === "moa" ? ` — under /model moa the executor ${s.moaTeam()?.specialist} takes them` : ""}`);
|
|
2893
|
+
break;
|
|
2894
|
+
}
|
|
2895
|
+
if (a.kind === "guard")
|
|
2896
|
+
setGuard({ guard: a.on });
|
|
2897
|
+
else if (a.kind === "push")
|
|
2898
|
+
setGuard({ allowPush: a.on });
|
|
2899
|
+
else if (a.kind === "off") {
|
|
2900
|
+
s.setMoaPlanner("");
|
|
2901
|
+
settings.moa = { ...settings.moa, plannerModel: "" };
|
|
2902
|
+
saveSettings({ moa: { plannerModel: "" } });
|
|
2903
|
+
setGuard({ guard: false, allowPush: false });
|
|
2904
|
+
}
|
|
2905
|
+
sys(status());
|
|
2906
|
+
break;
|
|
2907
|
+
}
|
|
2766
2908
|
case "allow": {
|
|
2767
2909
|
if (!arg) {
|
|
2768
2910
|
sys("usage: /allow <tool:args> e.g. /allow bash:npm test*");
|
|
@@ -2960,9 +3102,32 @@ function Root() {
|
|
|
2960
3102
|
}
|
|
2961
3103
|
case "agents": {
|
|
2962
3104
|
const l = bg.list();
|
|
3105
|
+
const paused = pausedRef.current;
|
|
3106
|
+
const pausedLines = paused.length
|
|
3107
|
+
? `\npaused — resume? (still working when Operator closed; /agents resume [name] · /agents discard):\n` + paused.map((a) => ` ⏸ ${a.name} · ${a.label} · round ${a.rounds}`).join("\n")
|
|
3108
|
+
: "";
|
|
3109
|
+
if (arg === "resume" || arg.startsWith("resume ")) {
|
|
3110
|
+
const want = arg.slice(6).trim().toLowerCase();
|
|
3111
|
+
const pick = want && want !== "all" ? paused.filter((a) => a.name.toLowerCase() === want || a.id === want) : paused;
|
|
3112
|
+
if (!pick.length) {
|
|
3113
|
+
sys(paused.length ? `no paused agent named ${want} — paused: ${paused.map((a) => a.name).join(", ")}` : "no paused agents");
|
|
3114
|
+
break;
|
|
3115
|
+
}
|
|
3116
|
+
const r = startSaved(pick, spawnSaved);
|
|
3117
|
+
pausedRef.current = [...paused.filter((a) => !pick.includes(a)), ...r.left];
|
|
3118
|
+
clearResumable(process.cwd()); // what is still paused is saved again on quit
|
|
3119
|
+
sys(r.line);
|
|
3120
|
+
break;
|
|
3121
|
+
}
|
|
3122
|
+
if (arg === "discard") {
|
|
3123
|
+
sys(paused.length ? `dropped ${paused.length} paused agent${paused.length === 1 ? "" : "s"}: ${paused.map((a) => a.name).join(", ")}` : "no paused agents");
|
|
3124
|
+
pausedRef.current = [];
|
|
3125
|
+
clearResumable(process.cwd());
|
|
3126
|
+
break;
|
|
3127
|
+
}
|
|
2963
3128
|
if (!arg) {
|
|
2964
3129
|
if (!l.length) {
|
|
2965
|
-
sys(
|
|
3130
|
+
sys(`no sub-agents spawned this session${pausedLines}`);
|
|
2966
3131
|
break;
|
|
2967
3132
|
}
|
|
2968
3133
|
const running = l.filter((a) => a.status === "working").length;
|
|
@@ -2970,7 +3135,7 @@ function Root() {
|
|
|
2970
3135
|
const done = l.filter((a) => a.status === "idle").length;
|
|
2971
3136
|
const errored = l.filter((a) => a.status === "stopped").length;
|
|
2972
3137
|
const counts = [running ? `${running} running` : "", queued ? `${queued} queued` : "", done ? `${done} done` : "", errored ? `${errored} errored` : ""].filter(Boolean).join(" · ");
|
|
2973
|
-
sys(`sub-agents (${counts}):\n` + l.map((a) => ` ${formatAgentDetail(a)}`).join("\n"));
|
|
3138
|
+
sys(`sub-agents (${counts}):\n` + l.map((a) => ` ${formatAgentDetail(a)}${a.resumed ? " · resumed" : ""}`).join("\n") + pausedLines);
|
|
2974
3139
|
break;
|
|
2975
3140
|
}
|
|
2976
3141
|
const parts = parseAgentCommand(arg, [...l, ...bg.retiredList()]);
|
|
@@ -3178,7 +3343,16 @@ function Root() {
|
|
|
3178
3343
|
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
3344
|
break;
|
|
3180
3345
|
}
|
|
3181
|
-
default:
|
|
3346
|
+
default: {
|
|
3347
|
+
const skill = skillCommand(name);
|
|
3348
|
+
if (!skill) {
|
|
3349
|
+
sys(`unknown command /${name} — try /help`);
|
|
3350
|
+
break;
|
|
3351
|
+
}
|
|
3352
|
+
await slashRef.current(`/skill ${skill}`);
|
|
3353
|
+
if (arg && s.currentSkill() === skill)
|
|
3354
|
+
submitRef.current(arg);
|
|
3355
|
+
}
|
|
3182
3356
|
}
|
|
3183
3357
|
}, [exit, sys, bg, authUser, approval, settleApproval, settleQuestion, applyMode, applyContext, openPicker, openContextPicker, refreshFreeRows, remoteCommand, remotePrompt]);
|
|
3184
3358
|
const onSubmit = useCallback((text) => {
|
|
@@ -3621,7 +3795,7 @@ function Root() {
|
|
|
3621
3795
|
if (boot === "down") {
|
|
3622
3796
|
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
3797
|
? _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
|
|
3798
|
+
: _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
3799
|
}
|
|
3626
3800
|
// While a turn runs, show a LIVE line: braille spinner + climbing token count + live tok/s + elapsed
|
|
3627
3801
|
// seconds. When idle, show the last turn's final "N tok · X tok/s · Ys". Never freeze on the previous
|
|
@@ -3681,7 +3855,7 @@ function Root() {
|
|
|
3681
3855
|
decode: shownPhase === "thinking" || shownPhase === "writing" || shownPhase === "drafting" ? decodeView() : undefined,
|
|
3682
3856
|
}
|
|
3683
3857
|
: null;
|
|
3684
|
-
return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, phase: phaseView, fold: liveFold, delegate: delegate, thinkingVerb: stepVerb ?? triage ?? phaseVerb(shownPhase ?? undefined, phaseView?.read), liveTools: liveTools, route: route, ctxPct: ctxPct, ctxWindow: session.currentModel() === "moa" ? (ctxPin ? fmtCtx(ctxPin) : undefined) : fmtCtx(ctxPin ? Math.min(ctxPin, session.servedContext()) : session.servedContext()), version: VERSION, fullscreen: FULLSCREEN, metrics: liveMetrics, sessionTokens: session.sessionTokens() + liveTok, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, thinkMode: thinkMode, verbs: settings.verbs, bgAgents: bgAgents, shellJobs: shellJobs, mainLane: mainLane, mainServing: servingModelFor(settings, session.currentModel()), maxRunning: bg.limits().running, onBackground: onBackground, tasks: tasks, planNow: planLive ? Date.now() : lastTurnEndRef.current, onSubmit: onSubmit, onQueue: onQueue, onSteer: onSteer, pending: pending, nextSteps: nextSteps ?? undefined, onPickNext: onPickNext, onDismissNext: onDismissNext, agents: bgAgents, onAgentMessage: onAgentMessage, conversations: convs, switcher: { focused: switcher.focused, sel: Math.max(0, convs.findIndex((c) => c.id === switcher.sel)), open: openConv }, onSwitcher: onSwitcher, onFocusSwitcher: onFocusSwitcher, conversationPane: conversationPane, onSendTo: onSendTo, actOffer: active ? actNowOffer(actRef.current, Date.now(), { thinking: thinkMode !== "off" }) : null, onActNow: onActNow, finder: finder, onOpenFinder: onOpenFinder, onEditQueued: popQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onExpand: onExpand, onCycleMode: onCycleMode, onCycleContext: onCycleContext, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, caffeinated: caffeinated, approval: approval, question: question, modelPicker: modelPicker, secretPrompt: secretPrompt, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, onApprovalDecide: (allow, always) => {
|
|
3858
|
+
return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, phase: phaseView, fold: liveFold, delegate: delegate, thinkingVerb: stepVerb ?? triage ?? phaseVerb(shownPhase ?? undefined, phaseView?.read), liveTools: liveTools, route: route, ctxPct: ctxPct, ctxWindow: session.currentModel() === "moa" ? (ctxPin ? fmtCtx(ctxPin) : undefined) : fmtCtx(ctxPin ? Math.min(ctxPin, session.servedContext()) : session.servedContext()), version: VERSION, fullscreen: FULLSCREEN, metrics: liveMetrics, sessionTokens: session.sessionTokens() + liveTok, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, thinkMode: thinkMode, verbs: settings.verbs, bgAgents: bgAgents, shellJobs: shellJobs, mainLane: mainLane, mainServing: servingModelFor(settings, session.currentModel()), maxRunning: bg.limits().running, onBackground: onBackground, tasks: tasks, planNow: planLive ? Date.now() : lastTurnEndRef.current, onSubmit: onSubmit, onQueue: onQueue, onSteer: onSteer, pending: pending, nextSteps: nextSteps ?? undefined, onPickNext: onPickNext, onDismissNext: onDismissNext, agents: bgAgents, onAgentMessage: onAgentMessage, conversations: convs, switcher: { focused: switcher.focused, sel: Math.max(0, convs.findIndex((c) => c.id === switcher.sel)), open: openConv }, onSwitcher: onSwitcher, onFocusSwitcher: onFocusSwitcher, conversationPane: conversationPane, onSendTo: onSendTo, actOffer: active ? actNowOffer(actRef.current, Date.now(), { thinking: thinkMode !== "off" }) : null, onActNow: onActNow, finder: finder, onOpenFinder: onOpenFinder, onEditQueued: popQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onExpand: onExpand, onCycleMode: onCycleMode, onCycleContext: onCycleContext, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, caffeinated: caffeinated, approval: approval, question: question, modelPicker: modelPicker, secretPrompt: secretPrompt, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, update: updatePrompt, onApprovalDecide: (allow, always) => {
|
|
3685
3859
|
const cur = approval;
|
|
3686
3860
|
if (cur)
|
|
3687
3861
|
settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
|
|
@@ -3711,6 +3885,11 @@ if (process.argv[2] === "gateway") {
|
|
|
3711
3885
|
const { runGateway } = await import("./gateway-cli.js");
|
|
3712
3886
|
process.exit(await runGateway(process.argv.slice(3)));
|
|
3713
3887
|
}
|
|
3888
|
+
// `operator phone setup|mcp` — the device harness's setup checklist and its MCP server (tools/device/).
|
|
3889
|
+
if (process.argv[2] === "phone") {
|
|
3890
|
+
const { runPhone } = await import("./phone-cli.js");
|
|
3891
|
+
process.exit(await runPhone(process.argv.slice(3)));
|
|
3892
|
+
}
|
|
3714
3893
|
// `operator toolchain …` — the toolchain CLI (toolchain/ in the repo, dist/toolchain/ in the package).
|
|
3715
3894
|
if (process.argv[2] === "toolchain") {
|
|
3716
3895
|
const { runToolchain } = await import("./toolchain-cli.js");
|
|
@@ -3780,6 +3959,14 @@ else {
|
|
|
3780
3959
|
catch { /* best-effort; a write failure just re-shows next boot */ }
|
|
3781
3960
|
}
|
|
3782
3961
|
}
|
|
3962
|
+
{
|
|
3963
|
+
const { checkEnabled, checkForUpdate } = await import("./update-check.js");
|
|
3964
|
+
const { isSourceCheckout } = await import("./update.js");
|
|
3965
|
+
if (checkEnabled({ argv: process.argv, env: process.env, tty: !!process.stdin.isTTY && !!process.stdout.isTTY, settings, sourceCheckout: isSourceCheckout() })) {
|
|
3966
|
+
UPDATE_ASKED_AT = Date.now();
|
|
3967
|
+
UPDATE_CHECK = checkForUpdate(VERSION);
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3783
3970
|
// Ink would exit on the first ctrl+c itself; the composer owns that key (interrupt mid-turn, twice to quit at rest).
|
|
3784
3971
|
const inkInstance = render(_jsx(Root, {}), { exitOnCtrlC: false });
|
|
3785
3972
|
if (FULLSCREEN)
|
|
@@ -3790,6 +3977,10 @@ if (FULLSCREEN)
|
|
|
3790
3977
|
// something still holds the event loop open.
|
|
3791
3978
|
void inkInstance.waitUntilExit().then(() => "quit", () => "error").then(async (reason) => {
|
|
3792
3979
|
await teardown.run(reason);
|
|
3980
|
+
if (UPDATE_NOW) {
|
|
3981
|
+
const { runOfferedUpdate } = await import("./update-check.js");
|
|
3982
|
+
process.exitCode = await runOfferedUpdate(UPDATE_NOW);
|
|
3983
|
+
}
|
|
3793
3984
|
setTimeout(() => process.exit(process.exitCode ?? 0), 1500).unref();
|
|
3794
3985
|
});
|
|
3795
3986
|
// Ink erases the previous frame by line COUNT, computed from the terminal width at draw time. When the
|