@0perator/operator 0.1.285 → 0.1.313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -2
- package/dist/acp/agent.js +2 -1
- package/dist/acp/config-options.js +3 -1
- package/dist/acp/tool-map.js +2 -1
- package/dist/auth/commands.js +69 -13
- package/dist/autonomy/agent-cli.js +304 -0
- package/dist/autonomy/cloud-agent.js +439 -0
- package/dist/autonomy/cron-lifecycle.js +78 -0
- package/dist/autonomy/cron-lock.js +121 -0
- package/dist/autonomy/cron.js +216 -43
- package/dist/autonomy/delegate.js +5 -1
- package/dist/autonomy/incidents.js +135 -0
- package/dist/autonomy/session-factory.js +25 -16
- package/dist/background/index.js +40 -0
- package/dist/bus/inbox.js +20 -0
- package/dist/classifier/config.js +47 -0
- package/dist/classifier/modes.js +41 -0
- package/dist/classifier/types.js +1 -0
- package/dist/cli.js +529 -53
- package/dist/config/features.js +69 -0
- package/dist/config/persona.js +118 -99
- package/dist/config/scaffold.js +15 -0
- package/dist/config/settings.js +96 -6
- package/dist/consolidation/sleep.js +73 -11
- package/dist/engine/agent.js +275 -18
- package/dist/engine/anthropic-chat.js +343 -0
- package/dist/engine/aurora.js +101 -13
- package/dist/engine/batch-scheduler.js +41 -9
- package/dist/engine/classifier.js +85 -0
- package/dist/engine/compaction.js +24 -5
- package/dist/engine/fast-start.js +25 -0
- package/dist/engine/loop-guard.js +448 -0
- package/dist/engine/net-error.js +24 -0
- package/dist/engine/repetition-guard.js +180 -0
- package/dist/engine/selfheal.js +8 -0
- package/dist/engine/toolcalls.js +51 -1
- package/dist/engine/verify-gate.js +2 -0
- package/dist/flywheel/processor.js +78 -31
- package/dist/flywheel/srft.js +13 -0
- package/dist/hooks/index.js +196 -0
- package/dist/mcp/config.js +21 -1
- package/dist/memory/index.js +0 -0
- package/dist/memory/providers.js +210 -0
- package/dist/memory/session-catalog.js +422 -0
- package/dist/memory/session-providers.js +121 -0
- package/dist/memory/session-sources.js +335 -0
- package/dist/memory/skylark.js +131 -0
- package/dist/models/bench.js +103 -0
- package/dist/models/registry.js +144 -0
- package/dist/models/switch.js +69 -0
- package/dist/observability/blackbox.js +37 -0
- package/dist/permissions/policy.js +31 -6
- package/dist/router/discovery.js +127 -0
- package/dist/router/models.js +107 -16
- package/dist/router/portal.js +100 -0
- package/dist/router/router.js +1 -1
- package/dist/services/preflight.js +55 -7
- package/dist/session.js +316 -46
- package/dist/tools/chauffeur.js +12 -0
- package/dist/tools/executor.js +19 -9
- package/dist/tools/find-files.js +483 -0
- package/dist/tools/git-pr.js +94 -0
- package/dist/tools/incident-tools.js +82 -0
- package/dist/tools/memory.js +12 -2
- package/dist/tools/registry.js +281 -85
- package/dist/tools/semantic-compress.js +124 -0
- package/dist/tools/shell-context.js +1 -0
- package/dist/tools/shell-jobs.js +160 -0
- package/dist/tools/shell-session.js +170 -4
- package/dist/tools/wave-tools.js +609 -0
- package/dist/tools/wave2-tools.js +411 -0
- package/dist/ui/App.js +15 -4
- package/dist/ui/BgPanel.js +30 -6
- package/dist/ui/Composer.js +11 -1
- package/dist/ui/QuestionPrompt.js +31 -11
- package/dist/ui/SessionPicker.js +86 -0
- package/dist/ui/StatusRule.js +5 -5
- package/dist/ui/ToolStep.js +2 -1
- package/dist/ui/Transcript.js +17 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/liveTools.js +21 -3
- package/dist/ui/slashCommands.js +2 -0
- package/dist/util/screenshots.js +74 -8
- package/dist/util/slash.js +2 -2
- package/package.json +8 -2
- package/dist/engine/cli.js +0 -1171
- package/dist/router/models.js.bak +0 -78
- package/dist/router/models.js.bak-1791259923 +0 -78
- package/dist/router/models.js.bak-pre-gateway +0 -78
- package/dist/router/models.js.bak-pre-patch2 +0 -78
- package/dist/router/models.js.bak2 +0 -78
- package/dist/services/model-autodetect.js +0 -240
- package/dist/tools/native-redirect.js +0 -140
- package/dist/tools/power-tools.js +0 -627
- package/dist/tools/registry.js.bak-1791259948 +0 -1914
- package/dist/tools/registry.js.bak-pre-plugins +0 -1914
- package/dist/ui/BusTray.js +0 -70
- package/dist/ui/resize.js +0 -160
package/dist/cli.js
CHANGED
|
@@ -12,15 +12,16 @@ import { shouldPromptPlanExit, resolvePlanExit, PLAN_EXIT_OPTIONS } from "./ui/p
|
|
|
12
12
|
import { RemoteHost } from "./remote/host.js";
|
|
13
13
|
import { newCode, pairURL } from "./remote/pairing.js";
|
|
14
14
|
import { qrToTerminal } from "./ui/qr.js";
|
|
15
|
-
import { pollBus, pollSent, selfAgent } from "./bus/inbox.js";
|
|
15
|
+
import { pollBus, pollSent, selfAgent, buildMentorWake, selectReadyWakes } from "./bus/inbox.js";
|
|
16
16
|
import { isErrorResult, resultPreview } from "./ui/format.js";
|
|
17
17
|
import { seedLiveTools, settleLiveTool } from "./ui/liveTools.js";
|
|
18
18
|
import { Session } from "./session.js";
|
|
19
|
+
import { buildMemory } from "./memory/providers.js";
|
|
19
20
|
import { cacheBustNotice } from "./engine/aurora.js";
|
|
20
21
|
import { seedCalibration } from "./engine/calibration-seed.js";
|
|
21
22
|
import { AuroraRouter } from "./router/router.js";
|
|
22
23
|
import { BackgroundAgents } from "./background/index.js";
|
|
23
|
-
import { loadSettings, saveSettings, compactionThreshold, compactionCeilingTokens, rcAutostart, applySeat, setActiveSeat } from "./config/settings.js";
|
|
24
|
+
import { loadSettings, saveSettings, compactionThreshold, compactionCeilingTokens, rcAutostart, applySeat, setActiveSeat, buildEndpointChain } from "./config/settings.js";
|
|
24
25
|
import { resolveSeat } from "./auth/identity.js";
|
|
25
26
|
import { PermissionPolicy } from "./permissions/index.js";
|
|
26
27
|
import { caps } from "./ui/capabilities.js";
|
|
@@ -28,8 +29,13 @@ import { composeSystemPrompt, appendMemory } from "./config/persona.js";
|
|
|
28
29
|
import { applyToolsBinPath, operatorPath } from "./config/home.js";
|
|
29
30
|
import { ensureOperatorHome } from "./config/scaffold.js";
|
|
30
31
|
import { listLocalSkills } from "./config/skills-index.js";
|
|
31
|
-
import { modelCtxFor,
|
|
32
|
-
import {
|
|
32
|
+
import { modelCtxFor, leanHarnessFor, selectModel, modelRegistry, DEFAULT_MODEL_ID } from "./router/models.js";
|
|
33
|
+
import { fetchPortalModels, markPickerOptions, offlineNote, portalIdFor } from "./router/portal.js";
|
|
34
|
+
import { describeTurnError } from "./engine/net-error.js";
|
|
35
|
+
import { hasByoToken } from "./auth/byo.js";
|
|
36
|
+
import { getDiscoveredModels } from "./router/discovery.js";
|
|
37
|
+
import { disposeShellSession, getAgentTasks, registry } from "./tools/registry.js";
|
|
38
|
+
import { drainJobNotices, getJobNoticeMode, listShellJobs, onJobEvent, parseJobsArgs, pendingJobNotices, renderJobsList, setJobNoticeMode, stopShellJob } from "./tools/shell-jobs.js";
|
|
33
39
|
import { disposeBrowserNow } from "./browser/session.js";
|
|
34
40
|
import { EventSink, defaultEventsFile } from "./telemetry/events.js";
|
|
35
41
|
import { SessionTracker } from "./telemetry/lifecycle.js";
|
|
@@ -37,12 +43,16 @@ import { centralRecording, defaultIngest, setCentralEnabled } from "./telemetry/
|
|
|
37
43
|
import { Teardown } from "./util/teardown.js";
|
|
38
44
|
import { installProcessTeardown } from "./session-teardown.js";
|
|
39
45
|
import { reapStaleChildren } from "./util/owned-children.js";
|
|
40
|
-
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
46
|
+
import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync, existsSync } from "node:fs";
|
|
41
47
|
import { expandFileMentions } from "./util/mentions.js";
|
|
42
48
|
import { snapshotEphemeralImages } from "./util/screenshots.js";
|
|
49
|
+
import { isFeatureEnabled } from "./config/features.js";
|
|
50
|
+
import { classifyActVsAsk, actAskGateDirective } from "./engine/classifier.js";
|
|
43
51
|
import { throttle } from "./util/throttle.js";
|
|
44
52
|
import { isSlashCommand } from "./util/slash.js";
|
|
45
53
|
import * as compose from "./compose/client.js";
|
|
54
|
+
import { catalogEntry, continuationContext, folderExists, indexCatalog, searchCatalog, sessionSearchConfig } from "./memory/session-catalog.js";
|
|
55
|
+
import { titleFrom } from "./memory/session-sources.js";
|
|
46
56
|
import { execFile } from "node:child_process";
|
|
47
57
|
import { join, dirname } from "node:path";
|
|
48
58
|
import { homedir, hostname } from "node:os";
|
|
@@ -59,6 +69,27 @@ const VERSION = (() => {
|
|
|
59
69
|
return "0.0.0";
|
|
60
70
|
}
|
|
61
71
|
})();
|
|
72
|
+
// Masthead context badge — the served window of the ACTIVE model, truthfully (1,000,000 → "1M", 131072 →
|
|
73
|
+
// "128K"). Pure (no I/O), so the --help fast path below stays instant; the boot masthead passes the live
|
|
74
|
+
// value. Replaces a long-hardcoded "300K" that drifted the moment the model/window changed.
|
|
75
|
+
function ctxBadge(n) {
|
|
76
|
+
if (!(n > 0))
|
|
77
|
+
return "";
|
|
78
|
+
if (n >= 1_000_000)
|
|
79
|
+
return Number.isInteger(n / 1_000_000) ? `${n / 1_000_000}M` : `${(n / 1_000_000).toFixed(1)}M`;
|
|
80
|
+
return n >= 1024 ? `${Math.round(n / 1024)}K` : String(n);
|
|
81
|
+
}
|
|
82
|
+
// The model the session will actually start on — NOT the raw persisted id. Mirrors Session's startup
|
|
83
|
+
// resolution (session.ts: setModel(cfg.activeModel) else DEFAULT_MODEL_ID) so the boot masthead badges the
|
|
84
|
+
// window of the model that answers, not a persisted id that the owner-only gate / missing-endpoint check
|
|
85
|
+
// drops back to operator-1m. Pure (selectModel is a pure reducer, no health I/O), so the fast paths stay instant.
|
|
86
|
+
function startupModelId(s, actor) {
|
|
87
|
+
const id = s.activeModel;
|
|
88
|
+
if (!id || id === DEFAULT_MODEL_ID)
|
|
89
|
+
return DEFAULT_MODEL_ID;
|
|
90
|
+
const isOwner = (actor.tier ?? "admin") === "admin";
|
|
91
|
+
return selectModel(modelRegistry(s.models), id, hasByoToken, isOwner).profile ? id : DEFAULT_MODEL_ID;
|
|
92
|
+
}
|
|
62
93
|
// Fast paths that must NOT mount Ink/React (so `operator --version` works with no TTY and returns instantly)
|
|
63
94
|
// — and must not do ANY identity I/O either. They used to sit BELOW the boot credential load, so even
|
|
64
95
|
// `--version` paid a keychain child-process spawn on the critical path: with a hung `security` helper the
|
|
@@ -69,7 +100,7 @@ if (process.argv.includes("--version") || process.argv.includes("-V")) {
|
|
|
69
100
|
process.exit(0);
|
|
70
101
|
}
|
|
71
102
|
if (process.argv.includes("--help")) {
|
|
72
|
-
process.stdout.write(mastheadLines(`
|
|
103
|
+
process.stdout.write(mastheadLines(`v${VERSION}`).join("\n") +
|
|
73
104
|
"\n\nUsage:\n operator start the interactive session\n operator --resume resume the last session in this directory\n operator --update update to the latest build (git fast-forward)\n operator --fullscreen fullscreen layout: composer pinned to the bottom (or settings.ui.fullscreen)\n operator auth sign in / manage your AXE account\n operator run <task> run one task headless\n operator --version print the version\n");
|
|
74
105
|
process.exit(0);
|
|
75
106
|
}
|
|
@@ -103,14 +134,15 @@ if (settings.search?.autopilotUrl)
|
|
|
103
134
|
process.env.KODE_AUTOPILOT_URL = settings.search.autopilotUrl;
|
|
104
135
|
if (settings.selfImprove?.flywheel === false)
|
|
105
136
|
process.env.KODE_SELFIMPROVE = "0"; // opt out of turn-capture
|
|
106
|
-
if (settings.selfImprove?.memory)
|
|
107
|
-
process.env.KODE_SELFIMPROVE_MEMORY = "
|
|
137
|
+
if (settings.selfImprove?.memory === false)
|
|
138
|
+
process.env.KODE_SELFIMPROVE_MEMORY = "0"; // opt out of the closed loop (a stuck session leaves a durable lesson in .operator/memories.md) — ON by default
|
|
108
139
|
if (settings.verifyGate?.enabled === false)
|
|
109
140
|
process.env.KODE_VERIFY_GATE = "0"; // opt out of verify-before-done
|
|
110
141
|
if (settings.verifyGate?.maxNudges != null)
|
|
111
142
|
process.env.KODE_VERIFY_GATE_MAX = String(settings.verifyGate.maxNudges);
|
|
112
143
|
if (settings.background?.maxConcurrent != null)
|
|
113
144
|
process.env.KODE_BG_MAX = String(settings.background.maxConcurrent); // cap concurrent bg sub-agents
|
|
145
|
+
setJobNoticeMode(settings.background?.jobNotices ?? "wake"); // what a finished background shell job does: wake / queue / off
|
|
114
146
|
if (settings.background?.worktree === false)
|
|
115
147
|
process.env.KODE_BG_WORKTREE = "0"; // opt out of bg-agent git-worktree isolation
|
|
116
148
|
// Inline (native scrollback + the masthead boot) is the DEFAULT. Fullscreen (alt-screen; composer pinned
|
|
@@ -163,6 +195,13 @@ if (SEAT.dropToken) {
|
|
|
163
195
|
const { setOperatorToken } = await import("./engine/aurora.js");
|
|
164
196
|
setOperatorToken(undefined);
|
|
165
197
|
}
|
|
198
|
+
// Fleet model discovery (router/discovery.ts): auto-catalog each LIVE fleet node by what it advertises
|
|
199
|
+
// (/props + /v1/models) so a server dropped onto the fleet appears in /model — named + truthfully sized
|
|
200
|
+
// from the server, no code change. Merged UNDER settings.models so a hand override by id always wins.
|
|
201
|
+
// Fail-safe + bounded: a node that doesn't answer in 1.5s is simply absent (startup never blocks on a
|
|
202
|
+
// slow/down box). Skipped for auth/version/help so signed-out commands stay instant.
|
|
203
|
+
const DISCOVERED_MODELS = SKIP_SEAT ? [] : await getDiscoveredModels(settings.fleet?.auroraNodes ?? [], { timeoutMs: 1500 });
|
|
204
|
+
const MERGED_MODELS = [...DISCOVERED_MODELS, ...(settings.models ?? [])];
|
|
166
205
|
// Computer control (opt-in, macOS embodiment). When enabled: register the control tools into the shared
|
|
167
206
|
// registry and compute permission rules. The FOREGROUND forces each computer_* tool to "ask" so every
|
|
168
207
|
// action prompts the owner via the approve() bridge in <Root>; BACKGROUND sub-agents get them DENIED —
|
|
@@ -240,6 +279,57 @@ try {
|
|
|
240
279
|
mkdirSync(dirname(process.env.KODE_HANDOFF_FILE), { recursive: true });
|
|
241
280
|
}
|
|
242
281
|
catch { /* best-effort; the tools guard too */ }
|
|
282
|
+
// Session search keeps EVERY session (memory/session-catalog.ts): the resume file above is overwritten by the
|
|
283
|
+
// next session in this folder, so each session is also archived as its own file under sessions/archive/ with
|
|
284
|
+
// its folder, title and model. A resumed session adopts its archive, so continuing it never duplicates it.
|
|
285
|
+
const ARCHIVE_DIR = join(SESSION_DIR, "archive");
|
|
286
|
+
const freshArchive = () => ({
|
|
287
|
+
file: join(ARCHIVE_DIR, `${WORKSPACE_HASH}-${new Date().toISOString().replace(/[-:]/g, "").slice(0, 15)}-${randomUUID().slice(0, 8)}.json`),
|
|
288
|
+
cwd: process.cwd(),
|
|
289
|
+
startedAt: Date.now(),
|
|
290
|
+
});
|
|
291
|
+
const sessionArchive = freshArchive();
|
|
292
|
+
// A conversation that replaces the one on screen (/new, a legacy resume, continuing another agent's session)
|
|
293
|
+
// archives to a new file, so it never overwrites the session it replaced.
|
|
294
|
+
function newArchive() { Object.assign(sessionArchive, freshArchive()); }
|
|
295
|
+
function archiveSession(messages, model) {
|
|
296
|
+
const first = messages.find((m) => m.role === "user" && m.content.trim());
|
|
297
|
+
if (!first)
|
|
298
|
+
return; // nothing said yet — not a session worth keeping
|
|
299
|
+
const doc = {
|
|
300
|
+
version: 1, id: sessionArchive.file.slice(ARCHIVE_DIR.length + 1, -".json".length), cwd: sessionArchive.cwd,
|
|
301
|
+
title: titleFrom(first.content), model, startedAt: sessionArchive.startedAt, updatedAt: Date.now(), messages,
|
|
302
|
+
};
|
|
303
|
+
try {
|
|
304
|
+
mkdirSync(ARCHIVE_DIR, { recursive: true, mode: 0o700 });
|
|
305
|
+
writeFileSync(sessionArchive.file, JSON.stringify(doc), { mode: 0o600 });
|
|
306
|
+
}
|
|
307
|
+
catch { /* best-effort, like the resume file */ }
|
|
308
|
+
}
|
|
309
|
+
function adoptArchive(file) {
|
|
310
|
+
try {
|
|
311
|
+
const doc = JSON.parse(readFileSync(file, "utf8"));
|
|
312
|
+
Object.assign(sessionArchive, { file, cwd: doc.cwd ?? sessionArchive.cwd, startedAt: doc.startedAt ?? sessionArchive.startedAt });
|
|
313
|
+
}
|
|
314
|
+
catch { /* unreadable — keep archiving to this session's own file */ }
|
|
315
|
+
}
|
|
316
|
+
// The newest archive written from this folder (what `--resume` just reloaded), if any.
|
|
317
|
+
function latestArchiveHere() {
|
|
318
|
+
try {
|
|
319
|
+
const mine = readdirSync(ARCHIVE_DIR).filter((n) => n.startsWith(WORKSPACE_HASH + "-") && n.endsWith(".json")).map((n) => join(ARCHIVE_DIR, n));
|
|
320
|
+
return mine.sort((a, b) => statSync(b).mtimeMs - statSync(a).mtimeMs)[0] ?? null;
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
// Saved messages → transcript rows (the user/assistant turns a resume shows).
|
|
327
|
+
function transcriptEntries(saved) {
|
|
328
|
+
return saved
|
|
329
|
+
.filter((m) => (m.role === "user" || m.role === "assistant") && m.content.trim())
|
|
330
|
+
.map((m) => ({ kind: "message", message: { id: nextId(), role: m.role, content: m.content } }));
|
|
331
|
+
}
|
|
332
|
+
const compactCount = (n) => (n >= 1000 ? `${(n / 1000).toFixed(n >= 10_000 ? 0 : 1)}K` : String(n));
|
|
243
333
|
const EVENT_ACTOR = { tier: settings.permissions.tier ?? "admin", surface: process.argv[2] === "acp" ? "acp" : "cli", sub: settings.seat?.sub };
|
|
244
334
|
const eventSink = new EventSink();
|
|
245
335
|
// Startup audit — only for a seat that is audited at all (a narrowed tier / audit / gated mode); the inert owner
|
|
@@ -279,14 +369,11 @@ let REAPED = { owners: 0, killed: [], skipped: 0 };
|
|
|
279
369
|
// and `operator+` serve the same single tier (the air/1m/saddle roster collapsed once Aurora ran true
|
|
280
370
|
// 1,048,576-token context at full speed). No size-based routing decision remains.
|
|
281
371
|
function buildRouter() {
|
|
282
|
-
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (fo)
|
|
288
|
-
eps.push({ name: "failover", base: fo.base, model: fo.model, ctxLimit: fo.ctxWindow });
|
|
289
|
-
return new AuroraRouter(eps);
|
|
372
|
+
// Primary first; the fleet nodes + optional failover + cloud tier are reached only via the router's
|
|
373
|
+
// health-gated recover() when the current endpoint errors/degrades (routeBySize always picks the primary
|
|
374
|
+
// at index 0 since 1M fits every prompt). buildEndpointChain is the single source of truth shared with the
|
|
375
|
+
// headless session factory, so interactive + autonomy paths route around a wedged box identically.
|
|
376
|
+
return new AuroraRouter(buildEndpointChain(settings));
|
|
290
377
|
}
|
|
291
378
|
// One-line status for a sub-agent — shared by /bg (human) and the agent_status tool (model), so both
|
|
292
379
|
// surfaces agree on what "status" means instead of drifting into two formats.
|
|
@@ -314,6 +401,48 @@ function formatAgentDetail(a) {
|
|
|
314
401
|
parts.push("— errored");
|
|
315
402
|
return parts.join(" ");
|
|
316
403
|
}
|
|
404
|
+
// Full per-agent view for /agents <id> — everything the one-liner can't fit (task, model/lane, verify
|
|
405
|
+
// outcome, live tool steps, mission line) plus the msg/stop controls for a still-running child.
|
|
406
|
+
function formatAgentDeepView(a) {
|
|
407
|
+
const ds = DISPLAY_STATUS[a.status] ?? a.status;
|
|
408
|
+
const lines = [];
|
|
409
|
+
lines.push(`── ${a.id} [${ds}] ──`);
|
|
410
|
+
lines.push(` label: ${a.label}`);
|
|
411
|
+
if (a.task)
|
|
412
|
+
lines.push(` task: ${a.task.length > 120 ? a.task.slice(0, 119) + "…" : a.task}`);
|
|
413
|
+
if (a.model)
|
|
414
|
+
lines.push(` model: ${a.model}${a.lane ? ` · ${a.lane}` : ""}`);
|
|
415
|
+
lines.push(` round: ${a.round ?? 0}`);
|
|
416
|
+
const tokStr = a.tokens != null && a.tokens > 0 ? (a.tokens >= 1000 ? `${(a.tokens / 1000).toFixed(1)}k` : `${a.tokens}`) : "0";
|
|
417
|
+
lines.push(` tokens: ${tokStr}`);
|
|
418
|
+
const ms = a.status === "working" ? (a.startedAt != null ? Date.now() - a.startedAt : undefined) : a.durationMs;
|
|
419
|
+
if (ms != null)
|
|
420
|
+
lines.push(` elapsed: ${(ms / 1000).toFixed(1)}s`);
|
|
421
|
+
if (a.verified != null)
|
|
422
|
+
lines.push(` verified: ${a.verified ? "✓ yes" : `✗ no${a.verifyDetail ? " — " + a.verifyDetail : ""}`}`);
|
|
423
|
+
if (a.malformed)
|
|
424
|
+
lines.push(` malformed: ⚠ final_answer schema failure`);
|
|
425
|
+
if (a.progress)
|
|
426
|
+
lines.push(` mission: ${a.progress.slice(0, 100)}`);
|
|
427
|
+
if (a.steps && a.steps.length) {
|
|
428
|
+
lines.push(` tools:`);
|
|
429
|
+
for (const s of a.steps) {
|
|
430
|
+
lines.push(` ${s.running ? "▸" : "·"} ${s.name}${s.arg ? ` ${s.arg}` : ""}${s.running ? " …" : ""}`);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (a.lastOutput)
|
|
434
|
+
lines.push(` output: ${a.lastOutput.slice(0, 100)}`);
|
|
435
|
+
if (a.thought)
|
|
436
|
+
lines.push(` thinking: ${a.thought.slice(0, 100)}`);
|
|
437
|
+
if (a.status === "idle")
|
|
438
|
+
lines.push(`\n result posted to transcript — scroll up to see it`);
|
|
439
|
+
if (a.status === "working" || a.status === "queued") {
|
|
440
|
+
lines.push(`\n controls:`);
|
|
441
|
+
lines.push(` /agents ${a.id} msg <text> send a message to re-steer`);
|
|
442
|
+
lines.push(` /agents ${a.id} stop stop this agent`);
|
|
443
|
+
}
|
|
444
|
+
return lines.join("\n");
|
|
445
|
+
}
|
|
317
446
|
// The system prompt is assembled by config/persona.ts composeSystemPrompt — the SAME call the headless
|
|
318
447
|
// autonomy runners (autonomy/session-factory.ts) make — so the TUI and an unattended `operator run/loop`
|
|
319
448
|
// share one persona (Direct/unrestricted, media, verify-by-running) + project context + handoff.
|
|
@@ -324,7 +453,7 @@ const chauffeurReady = !!chauffeurServer || settings.mcp;
|
|
|
324
453
|
// for Aurora's 300K, it fills the window and the model recites it instead of answering. Below
|
|
325
454
|
// LEAN_HARNESS_CTX, drop the heavy memory/handoff, KEEPING the base persona (incl. the Direct/unrestricted
|
|
326
455
|
// section) so the model stays uncensored.
|
|
327
|
-
const LEAN_HARNESS =
|
|
456
|
+
const LEAN_HARNESS = leanHarnessFor(settings.activeModel, settings.models);
|
|
328
457
|
// TODO(R1b): built once at startup — a mid-session /model does not rebuild it (ctxTokens + lean follow the startup model).
|
|
329
458
|
const SYSTEM_PROMPT = composeSystemPrompt({ settings, cwd: process.cwd(), ctxTokens: modelCtxFor(settings.activeModel, settings.models), lean: LEAN_HARNESS, interactive: true, chauffeurReady });
|
|
330
459
|
const HELP = [
|
|
@@ -338,6 +467,7 @@ const HELP = [
|
|
|
338
467
|
" /stats session dashboard: turns · tools · tokens · throughput trend · context fill",
|
|
339
468
|
" /dashboard launch the live swarm console (watches every Operator session)",
|
|
340
469
|
" /artifacts browse + attach your Compose (compose.casa) artifacts: search · attach · copy url · delete",
|
|
470
|
+
" /sessions [query] search Operator's and other agents' sessions (providers in agents.md) and pick one up",
|
|
341
471
|
" /plan plan mode: read-only research + propose a plan (/plan again to execute)",
|
|
342
472
|
" /mode [plan|manual|auto] set operating mode (plan · manual · autonomous); also Shift+Tab to cycle",
|
|
343
473
|
" /think extended reasoning: Operator thinks before answering (/think again = off)",
|
|
@@ -345,9 +475,11 @@ const HELP = [
|
|
|
345
475
|
" /compact force-compact the conversation now",
|
|
346
476
|
" /remember <note> store a note to recall in future sessions",
|
|
347
477
|
" /memory [query] show remembered notes (all, or matching query)",
|
|
478
|
+
" /allow <tool:args> auto-allow a tool+args glob pattern in gated mode (e.g. bash:npm test*)",
|
|
479
|
+
" /skill <name|off> activate a skill as a system-prompt directive (/skill off to deactivate)",
|
|
348
480
|
" /mcp [on|off] fleet MCP tools: status, or switch the layer on/off (saved)",
|
|
349
481
|
" /login · /logout · /whoami /login opens the browser to approve; or /login <email> for a 6-digit code (then /login <code>); /login <token>",
|
|
350
|
-
" /agents
|
|
482
|
+
" /agents [id] detailed sub-agent status, or /agents <id> for a deep view + controls (msg/stop)",
|
|
351
483
|
" /bg <task|stop id> spawn a background sub-agent, list, or stop one",
|
|
352
484
|
" /new start a fresh conversation",
|
|
353
485
|
" /clear clear the screen (keeps the conversation)",
|
|
@@ -378,9 +510,10 @@ const REMOTE_SAFE_COMMANDS = [
|
|
|
378
510
|
{ name: "compact", description: "force-compact the conversation now" },
|
|
379
511
|
{ name: "remember", description: "store a note to recall in future sessions", args: "<note>" },
|
|
380
512
|
{ name: "memory", description: "show remembered notes", args: "[query]" },
|
|
513
|
+
{ name: "skill", description: "activate a skill as a system-prompt directive, or /skill off", args: "<name|off>" },
|
|
381
514
|
{ name: "mcp", description: "fleet MCP tools: status · switch the layer on/off", args: "[on|off]" },
|
|
382
515
|
{ name: "whoami", description: "show signed-in identity" },
|
|
383
|
-
{ name: "agents", description: "detailed sub-agent status
|
|
516
|
+
{ name: "agents", description: "detailed sub-agent status, or a per-agent deep view + controls", args: "[id] [msg <text>|stop]" },
|
|
384
517
|
{ name: "monitor", description: "toggle live event stream (tool decisions, turns, control)" },
|
|
385
518
|
{ name: "bg", description: "spawn a background sub-agent, list, or stop one", args: "<task|stop id>" },
|
|
386
519
|
{ name: "new", description: "start a fresh conversation" },
|
|
@@ -401,6 +534,8 @@ function Root() {
|
|
|
401
534
|
const [entries, setEntries] = useState([]);
|
|
402
535
|
const [live, setLive] = useState(null);
|
|
403
536
|
const [status, setStatus] = useState("idle");
|
|
537
|
+
const [prefill, setPrefill] = useState(""); // "reading context N%" during a long prefill
|
|
538
|
+
const prefillRef = useRef("");
|
|
404
539
|
const [stepLabel, setStepLabel] = useState(""); // tool(s) currently executing, for the step animation
|
|
405
540
|
const [liveTools, setLiveTools] = useState([]); // one row per call in the CURRENT batch,
|
|
406
541
|
// live: seeded "running" by onToolStart, each flips to done/error independently as onToolResult fires
|
|
@@ -415,6 +550,7 @@ function Root() {
|
|
|
415
550
|
// status rule as tokens stream (each SSE delta ≈ 1 token). Zero extra renders: it rides the per-delta
|
|
416
551
|
// setLive re-render that already happens, so there's no performance cost and no animation timer.
|
|
417
552
|
const [bgAgents, setBgAgents] = useState([]);
|
|
553
|
+
const [shellJobs, setShellJobs] = useState([]); // background SHELL jobs (shN), shown beside the sub-agents but never mixed with their ids
|
|
418
554
|
const [tasks, setTasks] = useState([]); // session TODO list for the plan pane, refreshed after task_* tools
|
|
419
555
|
const [authUser, setAuthUser] = useState(""); // signed-in identity for the status rule
|
|
420
556
|
const [planMode, setPlanMode] = useState(false); // /plan: read-only research + propose, shown as a status badge
|
|
@@ -445,11 +581,11 @@ function Root() {
|
|
|
445
581
|
resolve(answer);
|
|
446
582
|
setQuestion((cur) => (cur && cur.id === id ? null : cur));
|
|
447
583
|
}, []);
|
|
448
|
-
const askUser = useCallback((q, options) => new Promise((resolve) => {
|
|
584
|
+
const askUser = useCallback((q, options, multiSelect) => new Promise((resolve) => {
|
|
449
585
|
const id = "q_" + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
450
586
|
pendingQuestions.current.set(id, resolve);
|
|
451
|
-
setQuestion({ id, question: q, options, resolve: (a) => settleQuestion(id, a) });
|
|
452
|
-
remoteRef.current?.askUser(id, q, options); // mirror to followers (owner-scoped)
|
|
587
|
+
setQuestion({ id, question: q, options, resolve: (a) => settleQuestion(id, a), multiSelect });
|
|
588
|
+
remoteRef.current?.askUser(id, q, options); // mirror to followers (owner-scoped; follower prompt is single-select)
|
|
453
589
|
}), [settleQuestion]);
|
|
454
590
|
// /model picker: same QuestionPrompt UI pattern as ask_user, but purely local (never relayed) —
|
|
455
591
|
// it's a session setting, not something the model is asking.
|
|
@@ -460,6 +596,7 @@ function Root() {
|
|
|
460
596
|
const planProposedRef = useRef(false);
|
|
461
597
|
const [planExitPicker, setPlanExitPicker] = useState(null);
|
|
462
598
|
const [artifactsPicker, setArtifactsPicker] = useState(null);
|
|
599
|
+
const [sessionsPicker, setSessionsPicker] = useState(null);
|
|
463
600
|
const alwaysAllowRef = useRef(new Set());
|
|
464
601
|
// Remembers the email a `/login <email>` sent a 6-digit code to, so the follow-up `/login <code>`
|
|
465
602
|
// knows which address to verify against — the in-session twin of the shell's email-code login.
|
|
@@ -500,18 +637,23 @@ function Root() {
|
|
|
500
637
|
systemPrompt: SYSTEM_PROMPT,
|
|
501
638
|
thinkMode, // start in the SAME mode the badge shows (settings.ui.reasoning, default "think") — it was only ever the badge that defaulted on
|
|
502
639
|
router: buildRouter(),
|
|
640
|
+
memory: buildMemory(settings.memory), // provider composite when configured; bare store (byte-identical) otherwise
|
|
503
641
|
mcp: settings.mcp,
|
|
504
642
|
mcpHub: embodimentHub, // scoped chauffeur hub when embodiment is on (undefined otherwise → no change)
|
|
505
643
|
maxTokens: settings.maxTokens,
|
|
506
644
|
maxTurnTokens: settings.maxTurnTokens, // opt-in per-turn cost ceiling (total tokens); undefined → no cap
|
|
645
|
+
loopGuard: settings.loopGuard, // tool-loop + repetition guard thresholds (interactive: notices only unless hardStop is set)
|
|
646
|
+
hooks: settings.hooks, // lifecycle hooks (settings.hooks); inert unless tool hooks are configured
|
|
507
647
|
maxRounds: settings.autonomy?.maxRounds, // soft per-turn round budget (default 200) — a real build isn't cut off at 10
|
|
508
648
|
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)
|
|
509
649
|
compactionThreshold: compactionThreshold(settings), // settings.compaction.threshold / KODE_COMPACTION_THRESHOLD; undefined → 0.85
|
|
510
650
|
compactionCeilingTokens: compactionCeilingTokens(settings, settings.endpoints.aurora.ctxWindow, "interactive"), // INTERACTIVE mode ⇒ the tight ceiling (~24k) so each owner-facing reply decodes fast; compaction.ceilingTokens/env override, then the RAM-aware clamp. Headless autonomy uses the separate high ceiling (session-factory.ts)
|
|
511
651
|
temperature: settings.temperature,
|
|
512
652
|
recall: settings.memory.recall,
|
|
513
|
-
models:
|
|
653
|
+
models: MERGED_MODELS, // discovered fleet nodes + settings.models overrides (built-ins in router/models.ts)
|
|
514
654
|
moa: settings.moa, // MOA proposers/aggregator config (MOA-DESIGN.md); absent = "/model moa" explains
|
|
655
|
+
fastStart: settings.fastStart, // fast-model-vs-real-turn race (feature: fastStart, default OFF)
|
|
656
|
+
features: settings.features, // feature flags — registers flag-gated tools (e.g. cloudAgents) only when on
|
|
515
657
|
activeModel: settings.activeModel, // persisted /model choice, applied at startup
|
|
516
658
|
permissions: fgPermissions, // owner's policy + computer tools forced to "ask" when enabled (else bypass)
|
|
517
659
|
approve: approveFn, // renders the in-TUI approval prompt for any "ask" decision
|
|
@@ -597,11 +739,12 @@ function Root() {
|
|
|
597
739
|
if (!bgRef.current) {
|
|
598
740
|
bgRef.current = new BackgroundAgents((cwd) => new Session({
|
|
599
741
|
systemPrompt: SYSTEM_PROMPT,
|
|
600
|
-
router: new AuroraRouter(
|
|
601
|
-
|
|
602
|
-
]),
|
|
742
|
+
router: new AuroraRouter(buildEndpointChain(settings)), // same multi-tier self-heal chain as the foreground
|
|
743
|
+
memory: buildMemory(settings.memory), // sub-agents share the same provider-layer memory surface
|
|
603
744
|
maxTokens: settings.maxTokens,
|
|
604
745
|
maxTurnTokens: settings.maxTurnTokens, // opt-in per-turn cost ceiling also bounds a sub-agent's spend
|
|
746
|
+
loopGuard: settings.loopGuard,
|
|
747
|
+
hooks: settings.hooks, // sub-agents are gated by the same hooks (e.g. git-safety)
|
|
605
748
|
maxRoundsHard: 50, // a focused delegated sub-agent that hits 50 rounds isn't converging — cap it well below the foreground's 200 so a review/fix agent can't run away to round 40+ burning the shared Aurora (seen live 09-26)
|
|
606
749
|
background: true, // endpoint gate: this is a sub-agent — its Aurora requests yield the shared single slot to the interactive main turn (fixes the sub-agent-contention crawl + "4 min for a prompt")
|
|
607
750
|
cwd, // isolation: a code-editing bg agent gets its own worktree dir here so it can't touch the foreground tree
|
|
@@ -691,6 +834,7 @@ function Root() {
|
|
|
691
834
|
reports = await preflight.ensureServices({
|
|
692
835
|
aurora: { base: settings.endpoints.aurora.base, ...settings.services?.aurora },
|
|
693
836
|
autopilot: settings.services?.autopilot,
|
|
837
|
+
vision: settings.services?.vision,
|
|
694
838
|
onProgress: setBootDetail,
|
|
695
839
|
});
|
|
696
840
|
// If the lever COLD-STARTED Aurora, prime it (fire-and-forget) so the first real turn doesn't
|
|
@@ -711,16 +855,33 @@ function Root() {
|
|
|
711
855
|
try {
|
|
712
856
|
const saved = JSON.parse(readFileSync(SESSION_FILE, "utf8"));
|
|
713
857
|
if (session.restore(saved)) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
858
|
+
setEntries(transcriptEntries(saved));
|
|
859
|
+
const archived = latestArchiveHere();
|
|
860
|
+
if (archived)
|
|
861
|
+
adoptArchive(archived);
|
|
718
862
|
setCtxPct(session.ctxPct());
|
|
719
863
|
push({ kind: "message", message: { id: nextId(), role: "system", content: `resumed ${session.turnCount()} prior turns` } });
|
|
720
864
|
}
|
|
721
865
|
}
|
|
722
866
|
catch { /* no saved session to resume */ }
|
|
723
867
|
}
|
|
868
|
+
// Session search: keep the catalog warm in the background (incremental — only changed files are read)
|
|
869
|
+
// and say once, the first time it is ready, how much it can search and how to turn it off.
|
|
870
|
+
void sessionSearchConfig().then(async (cfg) => {
|
|
871
|
+
if (!cfg.enabled)
|
|
872
|
+
return;
|
|
873
|
+
const marker = operatorPath("state", "session-search-ready");
|
|
874
|
+
const first = !existsSync(marker);
|
|
875
|
+
const r = await indexCatalog(cfg.providers);
|
|
876
|
+
if (!first)
|
|
877
|
+
return;
|
|
878
|
+
try {
|
|
879
|
+
writeFileSync(marker, new Date().toISOString() + "\n");
|
|
880
|
+
}
|
|
881
|
+
catch { /* shown again next launch — harmless */ }
|
|
882
|
+
push({ kind: "message", message: { id: nextId(), role: "system", content: `Session search is ready — ${r.sessions} sessions · ${compactCount(r.messages)} messages searchable (Operator's and other agents' sessions on this machine — providers are listed in agents.md in your Operator home; the index never leaves it). ` +
|
|
883
|
+
`/sessions to search them and pick one up — I can search them too. Turn it off with "sessionSearch": { "enabled": false } in settings.json.` } });
|
|
884
|
+
}).catch(() => { });
|
|
724
885
|
// Feed the service-lever outcome to the frozen event stream (dashboard service-health tiles).
|
|
725
886
|
if (emitTelemetry) {
|
|
726
887
|
for (const r of reports) {
|
|
@@ -769,9 +930,20 @@ function Root() {
|
|
|
769
930
|
catch { /* auth is optional — never block the REPL */ }
|
|
770
931
|
})();
|
|
771
932
|
}, []);
|
|
772
|
-
const sendTurn = useCallback(async (text) => {
|
|
773
|
-
|
|
774
|
-
|
|
933
|
+
const sendTurn = useCallback(async (text, opts) => {
|
|
934
|
+
// Finished background shell jobs are announced at the start of the next turn (capped notices, never the
|
|
935
|
+
// full output). A wake turn has no user text: the notices are the whole prompt.
|
|
936
|
+
const notices = drainJobNotices();
|
|
937
|
+
if (notices) {
|
|
938
|
+
const heads = notices.split("\n\n").map((n) => "⤷ " + n.split("\n")[0].replace(/^\[system notice\] /, "")).join("\n");
|
|
939
|
+
push({ kind: "message", message: { id: nextId(), role: "system", content: heads } });
|
|
940
|
+
remoteRef.current?.system(heads);
|
|
941
|
+
}
|
|
942
|
+
const toSend = (notices ? notices + "\n\n" : "") + (opts?.wake ? "A background job finished (notice above). Continue the task if it matters; otherwise reply in one line." : text);
|
|
943
|
+
if (!opts?.wake) {
|
|
944
|
+
push({ kind: "message", message: { id: nextId(), role: "user", content: text } });
|
|
945
|
+
remoteRef.current?.userPrompt(text); // mirror to followers
|
|
946
|
+
}
|
|
775
947
|
remoteRef.current?.turnStart(); // allocate this turn's assistant id (stable stream→final)
|
|
776
948
|
liveText.current = "";
|
|
777
949
|
liveReasoning.current = "";
|
|
@@ -783,7 +955,19 @@ function Root() {
|
|
|
783
955
|
setElapsed(0);
|
|
784
956
|
setStat("thinking");
|
|
785
957
|
try {
|
|
786
|
-
|
|
958
|
+
// Options-vs-act gate (feature classifierGate, default OFF). When enabled, classify the turn via the
|
|
959
|
+
// axe-classifier sidecar; on "ask" inject the memories.md EXCEPTION directive for THIS turn only. Degraded
|
|
960
|
+
// (sidecar unreachable/slow) or flag OFF → no directive, behavior byte-identical to today.
|
|
961
|
+
let turnDirective;
|
|
962
|
+
if (isFeatureEnabled("classifierGate", settings)) {
|
|
963
|
+
const gate = await classifyActVsAsk(text, {
|
|
964
|
+
endpoint: settings.classifier?.endpoint,
|
|
965
|
+
apiKey: settings.classifier?.apiKey,
|
|
966
|
+
minScore: settings.classifier?.gateMinScore,
|
|
967
|
+
});
|
|
968
|
+
turnDirective = actAskGateDirective(true, gate) ?? undefined;
|
|
969
|
+
}
|
|
970
|
+
const outcome = await session.send(expandFileMentions(snapshotEphemeralImages(toSend)), {
|
|
787
971
|
onRoute: (label, pct) => {
|
|
788
972
|
setRoute(label);
|
|
789
973
|
setCtxPct(pct);
|
|
@@ -804,7 +988,18 @@ function Root() {
|
|
|
804
988
|
}
|
|
805
989
|
}
|
|
806
990
|
},
|
|
991
|
+
onPromptProgress: ({ processed, total }) => {
|
|
992
|
+
const label = `reading context ${Math.min(100, Math.round((processed / total) * 100))}%`;
|
|
993
|
+
if (label !== prefillRef.current) {
|
|
994
|
+
prefillRef.current = label;
|
|
995
|
+
setPrefill(label);
|
|
996
|
+
}
|
|
997
|
+
},
|
|
807
998
|
onDelta: (chunk) => {
|
|
999
|
+
if (prefillRef.current) {
|
|
1000
|
+
prefillRef.current = "";
|
|
1001
|
+
setPrefill("");
|
|
1002
|
+
}
|
|
808
1003
|
liveText.current += chunk;
|
|
809
1004
|
liveTokRef.current += 1; // ≈1 token per streamed delta; flushed to the counter on the throttled tick
|
|
810
1005
|
setStat("streaming");
|
|
@@ -815,6 +1010,10 @@ function Root() {
|
|
|
815
1010
|
// Thinking streams before/between content — accumulate it and show it dimmed in the live entry
|
|
816
1011
|
// (renderEntry renders `reasoning` above the answer, dimColor). Distinct from onDelta so the
|
|
817
1012
|
// thought process reads at lower opacity than the real answer, per the requested look.
|
|
1013
|
+
if (prefillRef.current) {
|
|
1014
|
+
prefillRef.current = "";
|
|
1015
|
+
setPrefill("");
|
|
1016
|
+
}
|
|
818
1017
|
liveReasoning.current += chunk;
|
|
819
1018
|
liveTokRef.current += 1; // reasoning tokens ARE generated tokens — count them so the live
|
|
820
1019
|
// counter + tok/s keep moving during a long thinking phase (they were frozen before content).
|
|
@@ -907,7 +1106,7 @@ function Root() {
|
|
|
907
1106
|
setTasks(getAgentTasks()); // refresh the plan pane
|
|
908
1107
|
setStat("thinking");
|
|
909
1108
|
},
|
|
910
|
-
});
|
|
1109
|
+
}, turnDirective);
|
|
911
1110
|
// A completed (not interrupted) turn while still in plan mode counts as "a plan was proposed" —
|
|
912
1111
|
// arms the exit-time Approve & run picker (see applyMode).
|
|
913
1112
|
if (!outcome.interrupted && session.inPlanMode())
|
|
@@ -958,7 +1157,8 @@ function Root() {
|
|
|
958
1157
|
}
|
|
959
1158
|
}
|
|
960
1159
|
catch (e) {
|
|
961
|
-
|
|
1160
|
+
const activeLabel = session.modelRegistry().find((m) => m.id === session.currentModel())?.label;
|
|
1161
|
+
push({ kind: "message", message: { id: nextId(), role: "assistant", content: describeTurnError(e.message, { label: activeLabel, bases: session.endpoints().map((x) => x.base) }) } });
|
|
962
1162
|
}
|
|
963
1163
|
finally {
|
|
964
1164
|
tracker.noteTurn();
|
|
@@ -966,6 +1166,8 @@ function Root() {
|
|
|
966
1166
|
setLive(null);
|
|
967
1167
|
setLiveTools([]); // an interrupt/error mid-batch must not leave stale "running" rows on screen
|
|
968
1168
|
setCtxPct(session.ctxPct());
|
|
1169
|
+
prefillRef.current = "";
|
|
1170
|
+
setPrefill("");
|
|
969
1171
|
setStat("idle");
|
|
970
1172
|
const live = bg.list().filter((a) => a.status === "working" || a.status === "queued");
|
|
971
1173
|
if (live.length)
|
|
@@ -975,6 +1177,7 @@ function Root() {
|
|
|
975
1177
|
writeFileSync(SESSION_FILE, JSON.stringify(session.snapshot()), { mode: 0o600 });
|
|
976
1178
|
}
|
|
977
1179
|
catch { /* auto-save is best-effort */ }
|
|
1180
|
+
archiveSession(session.snapshot(), session.currentModel());
|
|
978
1181
|
// Re-check capabilities after every turn: MCP discovery (first-turn only) may have just landed,
|
|
979
1182
|
// and any skill_fetch/skill_save this turn updated skillsRef above. A no-op diff never hits the wire.
|
|
980
1183
|
remoteRef.current?.setCapabilities(buildCapabilities());
|
|
@@ -983,8 +1186,33 @@ function Root() {
|
|
|
983
1186
|
setQueuedPreview("");
|
|
984
1187
|
if (q)
|
|
985
1188
|
submitRef.current(q);
|
|
1189
|
+
else
|
|
1190
|
+
wakeIfIdleRef.current();
|
|
986
1191
|
}
|
|
987
1192
|
}, []);
|
|
1193
|
+
// A background shell job finished (wake mode): start a turn so Operator reacts without being polled. Only when
|
|
1194
|
+
// idle with nothing typed-ahead; otherwise the notice rides along on the next turn. Jobs ending together coalesce.
|
|
1195
|
+
const wakeIfIdleRef = useRef(() => { });
|
|
1196
|
+
wakeIfIdleRef.current = () => {
|
|
1197
|
+
if (getJobNoticeMode() !== "wake" || pendingJobNotices() === 0)
|
|
1198
|
+
return;
|
|
1199
|
+
if (statusRef.current !== "idle" || queued.current)
|
|
1200
|
+
return;
|
|
1201
|
+
void sendTurn("", { wake: true });
|
|
1202
|
+
};
|
|
1203
|
+
useEffect(() => {
|
|
1204
|
+
let timer;
|
|
1205
|
+
const off = onJobEvent((e) => {
|
|
1206
|
+
setShellJobs(listShellJobs().filter((j) => j.status === "running"));
|
|
1207
|
+
if (e.type !== "finished")
|
|
1208
|
+
return;
|
|
1209
|
+
if (timer)
|
|
1210
|
+
clearTimeout(timer);
|
|
1211
|
+
timer = setTimeout(() => wakeIfIdleRef.current(), 400);
|
|
1212
|
+
});
|
|
1213
|
+
return () => { off(); if (timer)
|
|
1214
|
+
clearTimeout(timer); };
|
|
1215
|
+
}, []);
|
|
988
1216
|
const sys = useCallback((text) => {
|
|
989
1217
|
push({ kind: "message", message: { id: nextId(), role: "system", content: text } });
|
|
990
1218
|
remoteRef.current?.system(text);
|
|
@@ -1073,6 +1301,7 @@ function Root() {
|
|
|
1073
1301
|
setEntries([]);
|
|
1074
1302
|
setLive(null);
|
|
1075
1303
|
setCtxPct(0);
|
|
1304
|
+
newArchive();
|
|
1076
1305
|
sys("started a fresh conversation");
|
|
1077
1306
|
break;
|
|
1078
1307
|
case "model": {
|
|
@@ -1089,6 +1318,12 @@ function Root() {
|
|
|
1089
1318
|
saveSettings({ activeModel: s.currentModel() });
|
|
1090
1319
|
sys(`model → ${s.currentModel()} · ctx ${s.ctxPct()}% · turns ${s.turnCount()}`);
|
|
1091
1320
|
remoteRef.current?.setCapabilities(buildCapabilities()); // active model changed — re-sync attached followers
|
|
1321
|
+
// One honest line when the portal reports the chosen model down. Non-blocking (cache or ≤3s), silent when
|
|
1322
|
+
// the portal is unreachable or doesn't know the model — selection is never refused on portal state.
|
|
1323
|
+
const chosen = s.modelRegistry().find((m) => m.id === s.currentModel());
|
|
1324
|
+
if (chosen)
|
|
1325
|
+
void fetchPortalModels().then((cat) => { const note = offlineNote(chosen.label, cat?.get(portalIdFor(chosen))); if (note)
|
|
1326
|
+
sys(note); });
|
|
1092
1327
|
};
|
|
1093
1328
|
if (arg) {
|
|
1094
1329
|
apply(arg);
|
|
@@ -1096,16 +1331,29 @@ function Root() {
|
|
|
1096
1331
|
}
|
|
1097
1332
|
const active = s.currentModel();
|
|
1098
1333
|
const models = s.modelRegistry();
|
|
1099
|
-
const
|
|
1334
|
+
const plain = models.map((m) => `${m.label}${m.id === active ? " (active)" : ""}`);
|
|
1335
|
+
let shown = plain; // what the picker currently displays — resolve() maps the chosen text back through THIS
|
|
1100
1336
|
setModelPicker({
|
|
1101
1337
|
question: "Select a model",
|
|
1102
|
-
options,
|
|
1338
|
+
options: shown,
|
|
1103
1339
|
resolve: (answer) => {
|
|
1104
1340
|
setModelPicker(null);
|
|
1105
|
-
const idx =
|
|
1341
|
+
const idx = shown.indexOf(answer);
|
|
1106
1342
|
apply(idx >= 0 ? models[idx].id : answer.trim());
|
|
1107
1343
|
},
|
|
1108
1344
|
});
|
|
1345
|
+
// Live state markers from the portal: the picker opens instantly as before; if the catalog arrives it
|
|
1346
|
+
// re-renders the SAME rows (same order, same count) with a leading marker where the portal knows the model.
|
|
1347
|
+
// Any failure leaves the picker exactly as it was.
|
|
1348
|
+
void fetchPortalModels().then((cat) => {
|
|
1349
|
+
if (!cat)
|
|
1350
|
+
return;
|
|
1351
|
+
const marked = markPickerOptions(plain, models.map(portalIdFor), cat);
|
|
1352
|
+
if (marked.every((t, i) => t === plain[i]))
|
|
1353
|
+
return;
|
|
1354
|
+
shown = marked;
|
|
1355
|
+
setModelPicker((cur) => (cur && cur.question === "Select a model" ? { ...cur, options: marked } : cur));
|
|
1356
|
+
});
|
|
1109
1357
|
break;
|
|
1110
1358
|
}
|
|
1111
1359
|
case "artifacts": {
|
|
@@ -1171,6 +1419,94 @@ function Root() {
|
|
|
1171
1419
|
void load(() => compose.listMine());
|
|
1172
1420
|
break;
|
|
1173
1421
|
}
|
|
1422
|
+
case "sessions": {
|
|
1423
|
+
// Search every agent session on this machine (memory/session-catalog.ts) and pick one up. An Operator
|
|
1424
|
+
// session resumes in place; another agent's session (a provider in agents.md) continues HERE with its newest messages as a
|
|
1425
|
+
// framed turn (the submitRef inject path /artifacts uses), and the command that reopens it in its own
|
|
1426
|
+
// agent is printed alongside — both, so the owner chooses where to carry on.
|
|
1427
|
+
const cfg = await sessionSearchConfig();
|
|
1428
|
+
if (!cfg.enabled) {
|
|
1429
|
+
sys('session search is off — set "sessionSearch": { "enabled": true } in settings.json');
|
|
1430
|
+
break;
|
|
1431
|
+
}
|
|
1432
|
+
const setPatch = (patch) => setSessionsPicker((p) => (p ? { ...p, ...patch } : p));
|
|
1433
|
+
let seq = 0; // keystrokes search as you type; only the newest search may land
|
|
1434
|
+
const search = async (query, scope) => {
|
|
1435
|
+
const mine = ++seq;
|
|
1436
|
+
try {
|
|
1437
|
+
const hits = await searchCatalog(query, { scope, limit: 50 });
|
|
1438
|
+
const items = await Promise.all(hits.map(async (h) => ({ ...h, gone: h.cwd ? !(await folderExists(h.cwd)) : false })));
|
|
1439
|
+
if (mine === seq)
|
|
1440
|
+
setPatch({ items, loading: false, error: undefined });
|
|
1441
|
+
}
|
|
1442
|
+
catch (e) {
|
|
1443
|
+
if (mine === seq)
|
|
1444
|
+
setPatch({ loading: false, error: e.message });
|
|
1445
|
+
}
|
|
1446
|
+
};
|
|
1447
|
+
const onIntent = async (intent) => {
|
|
1448
|
+
switch (intent.kind) {
|
|
1449
|
+
case "close":
|
|
1450
|
+
setSessionsPicker(null);
|
|
1451
|
+
break;
|
|
1452
|
+
case "query":
|
|
1453
|
+
await search(intent.query, intent.scope);
|
|
1454
|
+
break;
|
|
1455
|
+
case "open": {
|
|
1456
|
+
const e = await catalogEntry(intent.id);
|
|
1457
|
+
if (!e) {
|
|
1458
|
+
setPatch({ error: "that session is no longer indexed — reopen /sessions" });
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
setSessionsPicker(null);
|
|
1462
|
+
if (e.source === "operator") {
|
|
1463
|
+
let saved;
|
|
1464
|
+
try {
|
|
1465
|
+
saved = JSON.parse(readFileSync(e.file, "utf8"));
|
|
1466
|
+
}
|
|
1467
|
+
catch { /* handled below */ }
|
|
1468
|
+
const msgs = (Array.isArray(saved) ? saved : saved?.messages);
|
|
1469
|
+
if (!msgs || !s.restore(msgs)) {
|
|
1470
|
+
sys(`could not resume "${e.title}" — its transcript is unreadable`);
|
|
1471
|
+
break;
|
|
1472
|
+
}
|
|
1473
|
+
setEntries(transcriptEntries(msgs));
|
|
1474
|
+
setLive(null);
|
|
1475
|
+
setCtxPct(s.ctxPct());
|
|
1476
|
+
if (e.file.startsWith(ARCHIVE_DIR))
|
|
1477
|
+
adoptArchive(e.file);
|
|
1478
|
+
else
|
|
1479
|
+
newArchive();
|
|
1480
|
+
sys(`resumed "${e.title}" — ${s.turnCount()} prior turns${e.cwd && e.cwd !== process.cwd() ? ` (from ${e.cwd})` : ""}`);
|
|
1481
|
+
break;
|
|
1482
|
+
}
|
|
1483
|
+
const ctx = await continuationContext(e.id);
|
|
1484
|
+
if (!ctx) {
|
|
1485
|
+
sys(`could not read "${e.title}" — its transcript moved or is unreadable`);
|
|
1486
|
+
break;
|
|
1487
|
+
}
|
|
1488
|
+
s.reset();
|
|
1489
|
+
setEntries([]);
|
|
1490
|
+
setLive(null);
|
|
1491
|
+
setCtxPct(0);
|
|
1492
|
+
newArchive(); // a fresh conversation, archived on its own
|
|
1493
|
+
sys(`continuing the ${e.agent} session "${e.title}" here.${e.resume ? `\nTo reopen it in ${e.agent} instead: ${e.resume}` : ""}`);
|
|
1494
|
+
submitRef.current(ctx.text);
|
|
1495
|
+
break;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
setSessionsPicker({ items: [], loading: true, initialQuery: arg, initialScope: "all", onIntent });
|
|
1500
|
+
try {
|
|
1501
|
+
await indexCatalog(cfg.providers);
|
|
1502
|
+
}
|
|
1503
|
+
catch (e) {
|
|
1504
|
+
setPatch({ loading: false, error: `indexing failed: ${e.message}` });
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1507
|
+
await search(arg, "all");
|
|
1508
|
+
break;
|
|
1509
|
+
}
|
|
1174
1510
|
case "route":
|
|
1175
1511
|
if (s.pinRoute(arg || "auto"))
|
|
1176
1512
|
sys(arg && arg !== "auto" ? `routing pinned to ${arg}` : "routing set to auto (by size)");
|
|
@@ -1223,6 +1559,33 @@ function Root() {
|
|
|
1223
1559
|
sys(m || "(no memories yet — /remember <note> to add one)");
|
|
1224
1560
|
break;
|
|
1225
1561
|
}
|
|
1562
|
+
case "skill": {
|
|
1563
|
+
if (!arg) {
|
|
1564
|
+
const c = s.currentSkill();
|
|
1565
|
+
sys(c ? `active skill: ${c} — /skill off to deactivate` : "no skill active — /skill <name> to activate");
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
if (arg === "off") {
|
|
1569
|
+
const was = s.currentSkill();
|
|
1570
|
+
s.deactivateSkill();
|
|
1571
|
+
sys(was ? `skill '${was}' deactivated` : "no skill was active");
|
|
1572
|
+
break;
|
|
1573
|
+
}
|
|
1574
|
+
const fetchTool = registry.get("skill_fetch");
|
|
1575
|
+
if (!fetchTool) {
|
|
1576
|
+
sys("skill system not available");
|
|
1577
|
+
break;
|
|
1578
|
+
}
|
|
1579
|
+
sys(`loading skill '${arg}'…`);
|
|
1580
|
+
const content = await fetchTool.run({ slug: arg });
|
|
1581
|
+
if (content.startsWith("error:")) {
|
|
1582
|
+
sys(content);
|
|
1583
|
+
break;
|
|
1584
|
+
}
|
|
1585
|
+
s.activateSkill(arg, content);
|
|
1586
|
+
sys(`skill '${arg}' activated — its instructions are now injected into the system prompt`);
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1226
1589
|
case "whoami":
|
|
1227
1590
|
sys(authUser ? `signed in as ${authUser}` : "not signed in — run `operator auth login` in your shell");
|
|
1228
1591
|
break;
|
|
@@ -1384,6 +1747,21 @@ function Root() {
|
|
|
1384
1747
|
void sendTurn(`Use the deep_research tool to research this thoroughly and give me a cited, multi-source brief: ${arg}`);
|
|
1385
1748
|
break;
|
|
1386
1749
|
}
|
|
1750
|
+
case "allow": {
|
|
1751
|
+
if (!arg) {
|
|
1752
|
+
sys("usage: /allow <tool:args> e.g. /allow bash:npm test*");
|
|
1753
|
+
break;
|
|
1754
|
+
}
|
|
1755
|
+
const colon = arg.indexOf(":");
|
|
1756
|
+
const pat = colon > 0 ? { tool: arg.slice(0, colon), args: arg.slice(colon + 1) } : { tool: arg };
|
|
1757
|
+
const sx = s;
|
|
1758
|
+
if (!sx.permissionCfg.allow)
|
|
1759
|
+
sx.permissionCfg.allow = [];
|
|
1760
|
+
sx.permissionCfg.allow.push(pat);
|
|
1761
|
+
sx.policy.addAllowPattern(pat);
|
|
1762
|
+
sys(`allow pattern added: ${pat.tool}${pat.args ? ":" + pat.args : ""}`);
|
|
1763
|
+
break;
|
|
1764
|
+
}
|
|
1387
1765
|
case "endpoints": {
|
|
1388
1766
|
const h = await s.endpointHealth();
|
|
1389
1767
|
sys("endpoints:\n" + s.endpoints().map((e) => ` ${h[e.name] ? "●" : "○"} ${e.name} ${e.base} ${e.model} ctx ${e.ctxWindow.toLocaleString()}`).join("\n"));
|
|
@@ -1548,6 +1926,7 @@ function Root() {
|
|
|
1548
1926
|
const reports = await ensureServices({
|
|
1549
1927
|
aurora: { base: settings.endpoints.aurora.base, ...settings.services?.aurora },
|
|
1550
1928
|
autopilot: settings.services?.autopilot,
|
|
1929
|
+
vision: settings.services?.vision,
|
|
1551
1930
|
});
|
|
1552
1931
|
const { searxngStatus, probeSearxng } = await import("./tools/searxng.js");
|
|
1553
1932
|
const sxActive = searxngStatus() === "active";
|
|
@@ -1562,16 +1941,56 @@ function Root() {
|
|
|
1562
1941
|
}
|
|
1563
1942
|
case "agents": {
|
|
1564
1943
|
const l = bg.list();
|
|
1565
|
-
if (!
|
|
1566
|
-
|
|
1944
|
+
if (!arg) {
|
|
1945
|
+
if (!l.length) {
|
|
1946
|
+
sys("no sub-agents spawned this session");
|
|
1947
|
+
break;
|
|
1948
|
+
}
|
|
1949
|
+
const running = l.filter((a) => a.status === "working").length;
|
|
1950
|
+
const queued = l.filter((a) => a.status === "queued").length;
|
|
1951
|
+
const done = l.filter((a) => a.status === "idle").length;
|
|
1952
|
+
const errored = l.filter((a) => a.status === "stopped").length;
|
|
1953
|
+
const counts = [running ? `${running} running` : "", queued ? `${queued} queued` : "", done ? `${done} done` : "", errored ? `${errored} errored` : ""].filter(Boolean).join(" · ");
|
|
1954
|
+
sys(`sub-agents (${counts}):\n` + l.map((a) => ` ${formatAgentDetail(a)}`).join("\n"));
|
|
1955
|
+
break;
|
|
1956
|
+
}
|
|
1957
|
+
const parts = arg.split(/\s+/);
|
|
1958
|
+
const targetId = parts[0];
|
|
1959
|
+
const subCmd = parts[1];
|
|
1960
|
+
const subArg = parts.slice(2).join(" ");
|
|
1961
|
+
// A finished agent decommissions out of the live map after its reap TTL — still show its
|
|
1962
|
+
// record (same honesty rule as agent_status's retiredList fallback) instead of "unknown".
|
|
1963
|
+
const target = l.find((a) => a.id === targetId) ?? bg.retiredList().find((a) => a.id === targetId);
|
|
1964
|
+
if (!target) {
|
|
1965
|
+
sys(`unknown agent ${targetId} — spawned this session: ${l.length ? l.map((x) => x.id).join(", ") : "none"}`);
|
|
1567
1966
|
break;
|
|
1568
1967
|
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1968
|
+
if (subCmd === "msg" || subCmd === "message") {
|
|
1969
|
+
if (!subArg) {
|
|
1970
|
+
sys("usage: /agents <id> msg <text>");
|
|
1971
|
+
break;
|
|
1972
|
+
}
|
|
1973
|
+
const ok = bg.sendToAgent(targetId, subArg);
|
|
1974
|
+
sys(ok ? `message sent to ${targetId}` : `${targetId} is not running — can only message working/queued agents`);
|
|
1975
|
+
}
|
|
1976
|
+
else if (subCmd === "stop" || subCmd === "kill") {
|
|
1977
|
+
sys(bg.stop(targetId) ? `stopped ${targetId}` : `${targetId} already finished`);
|
|
1978
|
+
}
|
|
1979
|
+
else {
|
|
1980
|
+
sys(formatAgentDeepView(target));
|
|
1981
|
+
}
|
|
1982
|
+
break;
|
|
1983
|
+
}
|
|
1984
|
+
case "jobs": {
|
|
1985
|
+
const cmd = parseJobsArgs(arg);
|
|
1986
|
+
if (cmd.kind === "error")
|
|
1987
|
+
sys(cmd.message);
|
|
1988
|
+
else if (cmd.kind === "stop") {
|
|
1989
|
+
sys(stopShellJob(cmd.id));
|
|
1990
|
+
setShellJobs(listShellJobs().filter((j) => j.status === "running"));
|
|
1991
|
+
}
|
|
1992
|
+
else
|
|
1993
|
+
sys("shell jobs:\n" + renderJobsList(listShellJobs()).split("\n").map((l) => " " + l).join("\n"));
|
|
1575
1994
|
break;
|
|
1576
1995
|
}
|
|
1577
1996
|
case "bg":
|
|
@@ -1750,6 +2169,8 @@ function Root() {
|
|
|
1750
2169
|
const next = cur === "auto" ? "manual" : cur === "manual" ? "plan" : "auto";
|
|
1751
2170
|
applyMode(next);
|
|
1752
2171
|
}, [applyMode]);
|
|
2172
|
+
// ctrl+b: move the running shell command to the background so the turn continues. Nothing running → nothing happens.
|
|
2173
|
+
const onBackground = useCallback(() => { session.detachShell(); }, []);
|
|
1753
2174
|
const onInterrupt = useCallback(() => {
|
|
1754
2175
|
if (statusRef.current === "idle") {
|
|
1755
2176
|
void teardown.run("quit");
|
|
@@ -1779,11 +2200,66 @@ function Root() {
|
|
|
1779
2200
|
if (boot !== "ready")
|
|
1780
2201
|
return;
|
|
1781
2202
|
const self = selfAgent();
|
|
2203
|
+
const WAKE_COOLDOWN_MS = 30000; // per-source min gap between wake injections (ping-pong guard, Ghost-reviewed)
|
|
2204
|
+
const lastWakeBySource = new Map();
|
|
2205
|
+
let wakeBuffer = [];
|
|
2206
|
+
// FAILSAFE (2026-10-22 live incident — the same [mentor-wake] turn was submitted twice, double-padding
|
|
2207
|
+
// context on the way to a wedged "compacting" session): dedupe by message id at the point of delivery, so
|
|
2208
|
+
// a message can never be rendered or woken on twice NO MATTER the cause (a re-entrant/overlapping pull()
|
|
2209
|
+
// tick, a double-mounted effect, a requeue on turn interrupt) — defense at the layer where the duplicate
|
|
2210
|
+
// actually becomes user-visible, instead of chasing every possible way two polls could overlap. Bounded
|
|
2211
|
+
// (not unbounded growth) by dropping ids once they've aged well past any plausible re-delivery window.
|
|
2212
|
+
const deliveredIds = new Map(); // msg.id -> first-seen ts
|
|
2213
|
+
const DEDUPE_TTL_MS = 10 * 60_000;
|
|
2214
|
+
const seen = (id, now) => {
|
|
2215
|
+
for (const [staleId, ts] of deliveredIds)
|
|
2216
|
+
if (now - ts > DEDUPE_TTL_MS)
|
|
2217
|
+
deliveredIds.delete(staleId);
|
|
2218
|
+
if (deliveredIds.has(id))
|
|
2219
|
+
return true;
|
|
2220
|
+
deliveredIds.set(id, now);
|
|
2221
|
+
return false;
|
|
2222
|
+
};
|
|
2223
|
+
let pulling = false; // reentrancy guard — pollBus's consume-once rename can still race if pull() overlaps itself
|
|
1782
2224
|
const pull = () => {
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
2225
|
+
if (pulling)
|
|
2226
|
+
return;
|
|
2227
|
+
pulling = true;
|
|
2228
|
+
try {
|
|
2229
|
+
const now = Date.now();
|
|
2230
|
+
const incoming = pollBus(self).filter((m) => !seen(`in:${m.id}`, now));
|
|
2231
|
+
for (const msg of incoming)
|
|
2232
|
+
push({ kind: "bus", id: nextId(), msg, direction: "in", at: Date.now() });
|
|
2233
|
+
for (const msg of pollSent(self).filter((m) => !seen(`out:${m.id}`, now))) {
|
|
2234
|
+
push({ kind: "bus", id: nextId(), msg, direction: "out", at: Date.now() });
|
|
2235
|
+
}
|
|
2236
|
+
// Wake-on-mentor (feature: wakeOnMentor, default OFF): a rendered bus message is only PIXELS for the human —
|
|
2237
|
+
// it never enters the model's context, so an idle autonomous session SEES a peer/teacher message but can't
|
|
2238
|
+
// ACT on it. When enabled, inject incoming messages as a turn via the user-prompt path (submit when idle,
|
|
2239
|
+
// queue when busy — never interrupt a running turn). PER-SOURCE COOLDOWN (ping-pong guard, Ghost-reviewed):
|
|
2240
|
+
// a source's first message wakes immediately; further messages from the SAME source within WAKE_COOLDOWN_MS
|
|
2241
|
+
// buffer and coalesce into one wake AFTER the window, so two agents waking each other can't run away — and
|
|
2242
|
+
// no message is dropped. settings.wakeOnMentor.from narrows which senders may drive a turn (unset = any).
|
|
2243
|
+
if (isFeatureEnabled("wakeOnMentor", settings)) {
|
|
2244
|
+
const allow = settings.wakeOnMentor?.from;
|
|
2245
|
+
const eligible = allow?.length ? incoming.filter((m) => allow.includes(m.from)) : incoming;
|
|
2246
|
+
wakeBuffer.push(...eligible);
|
|
2247
|
+
const ready = selectReadyWakes(wakeBuffer, lastWakeBySource, now, WAKE_COOLDOWN_MS);
|
|
2248
|
+
const wakeText = ready.length ? buildMentorWake(ready) : null;
|
|
2249
|
+
if (wakeText) {
|
|
2250
|
+
if (statusRef.current === "idle")
|
|
2251
|
+
submitRef.current?.(wakeText);
|
|
2252
|
+
else
|
|
2253
|
+
onQueue(wakeText);
|
|
2254
|
+
for (const m of ready)
|
|
2255
|
+
lastWakeBySource.set(m.from, now);
|
|
2256
|
+
wakeBuffer = wakeBuffer.filter((m) => !ready.includes(m));
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
finally {
|
|
2261
|
+
pulling = false;
|
|
2262
|
+
}
|
|
1787
2263
|
};
|
|
1788
2264
|
pull();
|
|
1789
2265
|
const id = setInterval(pull, 3000);
|
|
@@ -1808,7 +2284,7 @@ function Root() {
|
|
|
1808
2284
|
? `${spin} reading your prompt… (${fmtDuration(elapsed)})`
|
|
1809
2285
|
: `${spin} ${fmtMeta(elapsed, liveTok)}`
|
|
1810
2286
|
: metrics;
|
|
1811
|
-
return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, liveTools: liveTools, route: route, ctxPct: ctxPct, 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, tasks: tasks, onSubmit: onSubmit, onQueue: onQueue, queuedPreview: queuedPreview, onInterrupt: onInterrupt, onCycleMode: onCycleMode, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, approval: approval, question: question, modelPicker: modelPicker, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, onApprovalDecide: (allow, always) => {
|
|
2287
|
+
return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, prefill: prefill, liveTools: liveTools, route: route, ctxPct: ctxPct, 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, onBackground: onBackground, tasks: tasks, onSubmit: onSubmit, onQueue: onQueue, queuedPreview: queuedPreview, onInterrupt: onInterrupt, onCycleMode: onCycleMode, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, approval: approval, question: question, modelPicker: modelPicker, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, onApprovalDecide: (allow, always) => {
|
|
1812
2288
|
const cur = approval;
|
|
1813
2289
|
if (cur)
|
|
1814
2290
|
settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
|
|
@@ -1882,7 +2358,7 @@ if (FULLSCREEN) {
|
|
|
1882
2358
|
process.once(sig, () => { leaveAltScreen(); process.exit(0); });
|
|
1883
2359
|
}
|
|
1884
2360
|
else {
|
|
1885
|
-
process.stdout.write(mastheadLines(
|
|
2361
|
+
process.stdout.write(mastheadLines(`${ctxBadge(modelCtxFor(startupModelId(settings, EVENT_ACTOR), settings.models))} · v${VERSION}`).join("\n") + "\n");
|
|
1886
2362
|
// ONE-TIME ONLY: on a terminal without clickable links / copy-on-select (Terminal.app, or an unknown one),
|
|
1887
2363
|
// point the owner at the terminals Operator is built for — then persist the flag so it NEVER shows again.
|
|
1888
2364
|
// This is a single first-run pointer, not the per-boot tip that was removed. iTerm2/Ghostty/Kitty/WezTerm
|