@0perator/operator 0.1.359-next.0 → 0.1.360-next.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/dashboard/index.html +2 -2
- package/dist/autonomy/cloud-agent.js +2 -2
- package/dist/autonomy/headless.js +15 -6
- package/dist/autonomy/session-factory.js +2 -1
- package/dist/background/notices.js +1 -1
- package/dist/browser/session.js +7 -0
- package/dist/cli.js +94 -52
- package/dist/config/features.js +6 -5
- package/dist/config/persona.js +57 -40
- package/dist/config/settings.js +39 -55
- package/dist/engine/agent.js +72 -33
- package/dist/engine/aurora.js +24 -2
- package/dist/engine/compaction.js +27 -7
- package/dist/engine/decision-points.js +16 -4
- package/dist/engine/kv-slot.js +87 -0
- package/dist/engine/loop-guard.js +49 -18
- package/dist/engine/messages.js +8 -1
- package/dist/engine/progress-deadline.js +37 -0
- package/dist/engine/verify-gate.js +134 -9
- package/dist/enterprise/cli.js +13 -1
- package/dist/mcp/craft-server.js +5 -3
- package/dist/memory/live-progress.js +35 -6
- package/dist/permissions/policy.js +8 -0
- package/dist/permissions/signature.js +9 -0
- package/dist/products/artifact-library.js +47 -0
- package/dist/products/craft.js +58 -94
- package/dist/products/temple.js +230 -0
- package/dist/remote/host.js +28 -1
- package/dist/router/discovery.js +23 -6
- package/dist/router/models.js +29 -70
- package/dist/services/preflight.js +3 -41
- package/dist/session.js +121 -38
- package/dist/skills/catalogue.js +2 -0
- package/dist/skills/finder.js +1 -1
- package/dist/tools/background-result.js +26 -0
- package/dist/tools/chauffeur-native.js +6 -0
- package/dist/tools/craft.js +17 -6
- package/dist/tools/deferred.js +64 -30
- package/dist/tools/executor.js +4 -2
- package/dist/tools/paths.js +3 -3
- package/dist/tools/read-ledger.js +44 -0
- package/dist/tools/registry.js +218 -264
- package/dist/tools/sandbox.js +52 -39
- package/dist/tools/shell-context.js +5 -0
- package/dist/tools/shell-session.js +61 -29
- package/dist/tools/vision-gateway.js +79 -34
- package/dist/tools/wave-tools.js +2 -2
- package/dist/tools/wave2-tools.js +6 -6
- package/dist/ui/ArtifactPicker.js +2 -2
- package/dist/ui/Composer.js +9 -2
- package/dist/ui/StatusRule.js +1 -1
- package/dist/ui/modelPicker.js +1 -1
- package/dist/ui/nextStep.js +1 -0
- package/dist/ui/pending.js +10 -0
- package/dist/update.js +78 -4
- package/dist/util/retry.js +34 -0
- package/dist/util/slash.js +2 -1
- package/dist/vault/tool.js +3 -1
- package/mcp/powertools-toolbox.mjs +166 -1
- package/package.json +9 -13
- package/dashboard/README.md +0 -62
- package/dist/compose/client.js +0 -56
- package/mcp/README.md +0 -88
- package/mcp/powertools.md +0 -210
package/dashboard/index.html
CHANGED
|
@@ -463,10 +463,10 @@
|
|
|
463
463
|
mk({ ts: iso(230000), kind: "tool", session: s1, actor: { tier: "admin", surface: "cli" }, tool: { name: "fs.read", args: "path=src/index.ts", decision: "allow", outcome: "ok", durationMs: 42 } }),
|
|
464
464
|
mk({ ts: iso(220000), kind: "turn", session: s1, actor: { tier: "admin", surface: "cli" }, turn: { tokens: 812, tokPerSec: 47.3, ctxPct: 18, route: "aurora", durationMs: 1900 } }),
|
|
465
465
|
mk({ ts: iso(200000), kind: "control", session: s2, actor: { tier: "readonly", surface: "web" }, control: { event: "tier_resolved", detail: "readonly" } }),
|
|
466
|
-
mk({ ts: iso(190000), kind: "tool", session: s2, actor: { tier: "readonly", surface: "web" }, tool: { name: "fleet.ssh_exec", args: "host=
|
|
466
|
+
mk({ ts: iso(190000), kind: "tool", session: s2, actor: { tier: "readonly", surface: "web" }, tool: { name: "fleet.ssh_exec", args: "host=node-a", decision: "deny", outcome: "denied" } }),
|
|
467
467
|
mk({ ts: iso(189000), kind: "control", session: s2, actor: { tier: "readonly", surface: "web" }, control: { event: "tool_denied_by_tier", detail: "fleet.ssh_exec requires admin" } }),
|
|
468
468
|
mk({ ts: iso(150000), kind: "tool", session: s3, actor: { tier: "enterprise", surface: "mobile" }, tool: { name: "web.search", args: "q=aurora+status", decision: "ask", approved: true, outcome: "ok", durationMs: 610 } }),
|
|
469
|
-
mk({ ts: iso(120000), kind: "control", session: s3, actor: { tier: "enterprise", surface: "mobile" }, control: { event: "rc_connected", detail: "ssh:
|
|
469
|
+
mk({ ts: iso(120000), kind: "control", session: s3, actor: { tier: "enterprise", surface: "mobile" }, control: { event: "rc_connected", detail: "ssh:node-b" } }),
|
|
470
470
|
mk({ ts: iso(90000), kind: "turn", session: s3, actor: { tier: "enterprise", surface: "mobile" }, turn: { tokens: 340, tokPerSec: 51.0, ctxPct: 34, route: "aurora" } }),
|
|
471
471
|
mk({ ts: iso(60000), kind: "service", session: s1, actor: { tier: "admin", surface: "cli" }, service: { name: "aurora-1m", state: "up" } }),
|
|
472
472
|
mk({ ts: iso(30000), kind: "tool", session: s1, actor: { tier: "admin", surface: "cli" }, tool: { name: "code.write_file", args: "path=dashboard/server.mjs", decision: "allow", outcome: "error", durationMs: 12 } }),
|
|
@@ -25,7 +25,7 @@ const msg = (e) => (e instanceof Error ? e.message : String(e));
|
|
|
25
25
|
export const DEFAULT_CLOUD_IMAGE = "operator-cloud-agent:latest";
|
|
26
26
|
export const DEFAULT_CLOUD_WORKDIR = "/tmp/cloud-agents";
|
|
27
27
|
/** Default cap on concurrent (running/provisioning) cloud agents — LOW by design: each clones the repo under the
|
|
28
|
-
* host workdir, and
|
|
28
|
+
* host workdir, and a host may be disk-tight. Override with `settings.cloudAgents.maxConcurrent`. */
|
|
29
29
|
export const DEFAULT_CLOUD_MAX_CONCURRENT = 2;
|
|
30
30
|
/** Hard wall-clock bound on ONE docker/ssh CLIENT invocation (not the in-container run, which is detached). */
|
|
31
31
|
export const CLOUD_CMD_TIMEOUT_MS = 120_000;
|
|
@@ -101,7 +101,7 @@ export function cloudHosts(settings) {
|
|
|
101
101
|
export function resolveCloudHost(settings, hostId) {
|
|
102
102
|
const { hosts, defaultHost } = cloudHosts(settings);
|
|
103
103
|
if (!hosts.length) {
|
|
104
|
-
throw new Error('no cloud-agent hosts are configured — add one to settings.cloudAgents.hosts, e.g. {"id":"
|
|
104
|
+
throw new Error('no cloud-agent hosts are configured — add one to settings.cloudAgents.hosts, e.g. {"id":"build1","ssh":"user@host.example.com","image":"operator-cloud-agent:latest","workdir":"/tmp/cloud-agents"} and set settings.cloudAgents.defaultHost');
|
|
105
105
|
}
|
|
106
106
|
const ids = hosts.map((h) => h.id).join(", ");
|
|
107
107
|
const wanted = (hostId ?? "").trim() || defaultHost;
|
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
import { createAutonomySession } from "./session-factory.js";
|
|
7
7
|
import { runLoop } from "./loop.js";
|
|
8
8
|
import { makeReporter } from "./reporter.js";
|
|
9
|
-
import { recordLiveProgress, roundProgressed, touchedPaths } from "../memory/live-progress.js";
|
|
9
|
+
import { recordLiveProgress, roundProgressed, settleLiveProgress, touchedPaths } from "../memory/live-progress.js";
|
|
10
10
|
import { getAgentTasks } from "../tools/registry.js";
|
|
11
|
+
const newJournal = (prompt) => ({ session: `headless-${process.pid}`, prompt, touched: [], written: false });
|
|
12
|
+
function settleJournal(j, how) {
|
|
13
|
+
if (j.written)
|
|
14
|
+
settleLiveProgress(process.env.KODE_HANDOFF_FILE, { session: j.session, cwd: process.cwd(), request: j.prompt, tasks: getAgentTasks(), touched: j.touched }, how);
|
|
15
|
+
}
|
|
11
16
|
/** Streaming handlers that render a turn's activity through the reporter. Text deltas stream only in
|
|
12
17
|
* human mode (JSON mode reports the settled content as one event, to stay line-parseable). */
|
|
13
|
-
function handlersFor(reporter, json, prompt = "", onDelta) {
|
|
14
|
-
const touched =
|
|
15
|
-
const session = `headless-${process.pid}`;
|
|
18
|
+
function handlersFor(reporter, json, prompt = "", onDelta, journal = newJournal(prompt)) {
|
|
19
|
+
const { touched, session } = journal;
|
|
16
20
|
return {
|
|
17
21
|
onRoute: (label, ctxPct) => reporter.event("route", { route: label, ctxPct }),
|
|
18
22
|
onServed: (s) => reporter.event("fallback", { from: s.fallbackFrom, servedBy: s.backend ?? null }), // the selected model was down; another box answered
|
|
@@ -30,6 +34,7 @@ function handlersFor(reporter, json, prompt = "", onDelta) {
|
|
|
30
34
|
// Live progress journal, same contract as the TUI: a cut-off unattended run leaves its state in the handoff.
|
|
31
35
|
if (roundProgressed(events)) {
|
|
32
36
|
touched.push(...touchedPaths(events));
|
|
37
|
+
journal.written = true;
|
|
33
38
|
recordLiveProgress(process.env.KODE_HANDOFF_FILE, { session, cwd: process.cwd(), request: prompt, tasks: getAgentTasks(), touched });
|
|
34
39
|
}
|
|
35
40
|
},
|
|
@@ -50,7 +55,8 @@ export async function runHeadless(settings, prompt, opts = {}) {
|
|
|
50
55
|
});
|
|
51
56
|
let streamed = "";
|
|
52
57
|
const session = createAutonomySession(settings);
|
|
53
|
-
const
|
|
58
|
+
const journal = newJournal(prompt);
|
|
59
|
+
const handlers = handlersFor(reporter, output !== "text", prompt, (chunk) => { streamed += chunk; process.stdout.write(chunk); }, journal);
|
|
54
60
|
const answer = (content) => {
|
|
55
61
|
if (!content)
|
|
56
62
|
return;
|
|
@@ -94,6 +100,8 @@ export async function runHeadless(settings, prompt, opts = {}) {
|
|
|
94
100
|
reporter.event("done", { reason: res.reason, turns: res.turns, toolCalls: res.toolCalls });
|
|
95
101
|
result = { reason: res.reason, turns: res.turns, toolCalls: res.toolCalls };
|
|
96
102
|
answer(res.lastContent);
|
|
103
|
+
if (res.reason !== "error")
|
|
104
|
+
settleJournal(journal, res.reason === "interrupted" ? "stopped" : "completed"); // an errored loop stays resumable
|
|
97
105
|
await session.flushRouteShadow(); // MOA phase-0: the last turn's shadow record must not die with the process
|
|
98
106
|
return finish(res.reason === "error" ? 1 : res.reason === "interrupted" ? 130 : 0);
|
|
99
107
|
}
|
|
@@ -106,8 +114,9 @@ export async function runHeadless(settings, prompt, opts = {}) {
|
|
|
106
114
|
process.stdout.write("\n");
|
|
107
115
|
} // an engine stop always ends on its question, even after a cut-off stream
|
|
108
116
|
answer(outcome.display ?? outcome.content);
|
|
117
|
+
settleJournal(journal, outcome.interrupted ? "stopped" : "completed");
|
|
109
118
|
await session.flushRouteShadow(); // MOA phase-0: headless one-shot exits before fire-and-forget would land
|
|
110
|
-
return finish(outcome.interrupted ? 130 : outcome.stopKind === "unanswered" ? 1 : 0); // nothing answered
|
|
119
|
+
return finish(outcome.interrupted ? 130 : outcome.stopKind === "unanswered" || outcome.stopKind === "context_floor" ? 1 : 0); // nothing answered, or the model is served under the floor: a failed run
|
|
111
120
|
}
|
|
112
121
|
catch (e) {
|
|
113
122
|
const message = e instanceof Error ? e.message : String(e);
|
|
@@ -69,13 +69,14 @@ export function createAutonomySession(settings, opts = {}) {
|
|
|
69
69
|
// (setModel below) never loads it.
|
|
70
70
|
onDemand: auroraOnDemand(settings.endpoints.aurora, settings.services?.aurora, () => buildRouterFromSettings(settings)),
|
|
71
71
|
contextPin: settings.contextPin, // the owner's /context choice (KODE_CONTEXT wins in loadSettings) holds for headless, ACP and delegated runs too
|
|
72
|
+
contextFloor: settings.contextFloor,
|
|
72
73
|
permissions: opts.permissions ?? settings.permissions,
|
|
73
74
|
// Audit attribution: without these every headless/cron/dream tool event carried session:"" and no seat.
|
|
74
75
|
sessionId: `hl-${randomUUID().slice(0, 12)}`,
|
|
75
76
|
eventActor: { tier: settings.permissions?.tier ?? "admin", surface: "cli", sub: settings.seat?.sub },
|
|
76
77
|
telemetry: settings.telemetry,
|
|
77
78
|
compactionThreshold: compactionThreshold(settings),
|
|
78
|
-
compactionCeilingTokens: compactionCeilingTokens(settings,
|
|
79
|
+
compactionCeilingTokens: compactionCeilingTokens(settings, "autonomy"), // the owner's compaction.autonomyCeilingTokens / env, else no ceiling — never the interactive ceilingTokens, so a snappy interactive setting can't throttle an unattended build into a compaction-thrash loop
|
|
79
80
|
sleepConsolidation: settings.autonomy?.sleepConsolidation, // headless autonomy ("operator run/loop/dream") consolidates on idle too (0.1.177)
|
|
80
81
|
...opts.extra,
|
|
81
82
|
});
|
|
@@ -28,7 +28,7 @@ export function formatStuckNotice(agent) {
|
|
|
28
28
|
const ledger = [agent.round != null ? `${agent.round} rounds` : "", agent.written?.length ? `wrote ${agent.written.join(", ")}` : "no file writes recorded",
|
|
29
29
|
agent.reads ? `${agent.reads} reads` : "", agent.commands ? `${agent.commands} commands` : ""].filter(Boolean).join(", ");
|
|
30
30
|
return `[system notice] ${who(agent)} looks STUCK: ${agent.stuck} (${ledger}). Decide now and tell the owner in one line: ` +
|
|
31
|
-
`steer it (message_agent with the missing piece), or stop it (stop_agent) and do the step yourself, or stop it and re-brief ` +
|
|
31
|
+
`steer it (message_agent with the missing piece), or stop it (stop_agent) and do the step yourself (both tools on demand), or stop it and re-brief ` +
|
|
32
32
|
`a fresh sub-agent with a tighter brief. Waiting on it is not an option — it will not finish on its own.`;
|
|
33
33
|
}
|
|
34
34
|
/** The owner's few words for a queued report: "Iris's report", or "Orion's partial notes" for a stopped child. */
|
package/dist/browser/session.js
CHANGED
|
@@ -258,6 +258,10 @@ export function disposeBrowserNow() {
|
|
|
258
258
|
}
|
|
259
259
|
export const BROWSER_READ_ACTIONS = ["info", "text", "tab_list"];
|
|
260
260
|
export const BROWSER_ACT_ACTIONS = ["open", "navigate", "reload", "back", "forward", "eval", "click", "fill", "submit", "tab_select", "tab_close", "screenshot", "close"];
|
|
261
|
+
const SELECTOR = ["selector", '"button[type=submit]"'];
|
|
262
|
+
const BROWSER_NEEDS = {
|
|
263
|
+
navigate: ["url", '"https://example.com"'], click: SELECTOR, fill: SELECTOR, submit: SELECTOR, eval: ["js", '"document.title"'], tab_select: ["index", "0"],
|
|
264
|
+
};
|
|
261
265
|
/** The vault glue needs these two session primitives. */
|
|
262
266
|
export const browserSessionHooks = {
|
|
263
267
|
activeHref: () => session().href(),
|
|
@@ -265,6 +269,9 @@ export const browserSessionHooks = {
|
|
|
265
269
|
};
|
|
266
270
|
/** run() for the `browser` tool (ACT side, plus reads for convenience in ungated modes). */
|
|
267
271
|
export async function runBrowser(args) {
|
|
272
|
+
const need = BROWSER_NEEDS[String(args.action)];
|
|
273
|
+
if (need && (args[need[0]] == null || args[need[0]] === ""))
|
|
274
|
+
return `browser: ${args.action} needs \`${need[0]}\` — e.g. ${need[0]}: ${need[1]}`;
|
|
268
275
|
try {
|
|
269
276
|
return await session().run(String(args.action ?? "info"), args);
|
|
270
277
|
}
|
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ import { parseAgentCommand } from "./background/commands.js";
|
|
|
9
9
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { render, Box, Text, useApp } from "ink";
|
|
11
11
|
import { App } from "./ui/index.js";
|
|
12
|
+
import { restKey } from "./ui/Composer.js";
|
|
12
13
|
import { mastheadLines } from "./ui/Masthead.js";
|
|
13
14
|
import { shouldPromptPlanExit, resolvePlanExit, PLAN_EXIT_OPTIONS } from "./ui/planExit.js";
|
|
14
15
|
import { initialMode, modePolicy, nextMode, parseMode, planToggleTarget } from "./permissions/modes.js";
|
|
@@ -34,7 +35,7 @@ import { turnScoped } from "./ui/turnScope.js";
|
|
|
34
35
|
import { applyDrafts, bufferDraft, seedLiveTools, settleLiveTool, startLiveTool } from "./ui/liveTools.js";
|
|
35
36
|
import { Session } from "./session.js";
|
|
36
37
|
import { buildMemory } from "./memory/providers.js";
|
|
37
|
-
import { cacheBustNotice } from "./engine/aurora.js";
|
|
38
|
+
import { cacheBustNotice, anyReachable } from "./engine/aurora.js";
|
|
38
39
|
import { seedCalibration } from "./engine/calibration-seed.js";
|
|
39
40
|
import { AuroraRouter } from "./router/router.js";
|
|
40
41
|
import { BackgroundAgents } from "./background/index.js";
|
|
@@ -55,6 +56,7 @@ import { fallbackNotice, primaryRecoveredLine, recoveryLine } from "./engine/con
|
|
|
55
56
|
import { hasByoToken, setByoToken } from "./auth/byo.js";
|
|
56
57
|
import { getDiscoveredModels } from "./router/discovery.js";
|
|
57
58
|
import { disposeShellSession, getAgentTasks, registry } from "./tools/registry.js";
|
|
59
|
+
import { applySandboxMode } from "./tools/sandbox.js";
|
|
58
60
|
import { drainJobNotices, getJobNoticeMode, listShellJobs, onJobEvent, parseJobsArgs, pendingJobNotices, renderJobsList, runningJobCount, setJobNoticeMode, stopShellJob } from "./tools/shell-jobs.js";
|
|
59
61
|
import { drainAgentNotices, onAgentReport, pendingAgentReports, queueAgentReport, queueAgentNotice, formatStuckNotice } from "./background/notices.js";
|
|
60
62
|
import { reportLine, deliveredLine } from "./ui/reportLine.js";
|
|
@@ -80,9 +82,9 @@ import { resolveMode } from "./classifier/modes.js";
|
|
|
80
82
|
import { subagentModelFor, servingModelFor } from "./autonomy/subagent-model.js";
|
|
81
83
|
import { classifierConfig } from "./classifier/config.js";
|
|
82
84
|
import { throttle } from "./util/throttle.js";
|
|
83
|
-
import { isSlashCommand
|
|
85
|
+
import { isSlashCommand } from "./util/slash.js";
|
|
84
86
|
import { RateFeed, readRates, rereadCost } from "./router/read-rates.js";
|
|
85
|
-
import { popLatest, takeSteers } from "./ui/pending.js";
|
|
87
|
+
import { popLatest, queueRoute, takeSteers } from "./ui/pending.js";
|
|
86
88
|
import { createTurnFlow } from "./ui/turnFlow.js";
|
|
87
89
|
import { engineStopSteps, interruptSteps, settledPartial } from "./ui/nextStep.js";
|
|
88
90
|
import { MAIN, agentMention, conversationList, switcherKey, transcriptHeader, transcriptLines } from "./ui/conversations.js";
|
|
@@ -90,7 +92,7 @@ import { termRows } from "./ui/term.js";
|
|
|
90
92
|
import { actNowOffer, guardDetail } from "./ui/actNow.js";
|
|
91
93
|
import { OWNER_ACT_MESSAGE } from "./engine/owner-act.js";
|
|
92
94
|
import { HubUnreadable, SOURCE_LIMITS, defaultSources, draftSkillPrompt, quotedReference, skillSkeleton, skillSlug, trustedInstructions } from "./skills/finder.js";
|
|
93
|
-
import * as
|
|
95
|
+
import * as artifacts from "./products/artifact-library.js";
|
|
94
96
|
import { catalogEntry, continuationContext, folderExists, indexCatalog, searchCatalog, sessionSearchConfig } from "./memory/session-catalog.js";
|
|
95
97
|
import { titleFrom } from "./memory/session-sources.js";
|
|
96
98
|
import { execFile } from "node:child_process";
|
|
@@ -156,8 +158,9 @@ const settings = loadSettings();
|
|
|
156
158
|
// Enterprise first-run: make the operator home's contract explicit BEFORE any module writes into it (0700
|
|
157
159
|
// root, ignore-everything .gitignore, README, settings.example.json, home.json). Idempotent, never throws.
|
|
158
160
|
const HOME_SCAFFOLD = ensureOperatorHome({ version: VERSION });
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
+
// Bridge the resolved (managed + contextual-floor) sandbox mode to the tool layer: sandboxMode() reads
|
|
162
|
+
// KODE_SANDBOX at exec time, so a settings/managed "strict" that is never bridged would run unconfined.
|
|
163
|
+
applySandboxMode(settings.sandbox.mode);
|
|
161
164
|
// operator-home-v2 phase 5: the managed owner-CLI toolkit is a SINGLE PATH addition
|
|
162
165
|
// ($KODE_HOME/tools/bin, materialized by operator-home/tools/toolkit-verify.sh). Projected once at
|
|
163
166
|
// startup so every child inherits it — persistent bash, exec-file tools, in-process cron sessions.
|
|
@@ -571,7 +574,7 @@ const HELP = [
|
|
|
571
574
|
" /monitor live event stream — tool decisions, turns, control events (/monitor off)",
|
|
572
575
|
" /stats session dashboard: turns · tools · tokens · throughput trend · context fill",
|
|
573
576
|
" /dashboard launch the live swarm console (watches every Operator session)",
|
|
574
|
-
" /artifacts browse + attach your
|
|
577
|
+
" /artifacts browse + attach your artifacts: search · attach · copy url · delete",
|
|
575
578
|
" /sessions [query] search Operator's and other agents' sessions (providers in agents.md) and pick one up",
|
|
576
579
|
" /plan plan mode: read-only research + propose a plan (/plan again to execute)",
|
|
577
580
|
" /mode [auto|manual|plan|gated] set operating mode (autonomous · manual · plan · gated); Shift+Tab cycles the first three",
|
|
@@ -609,6 +612,7 @@ const fmtTokens = (n) => (n >= 1000 ? `${(n / 1000).toFixed(1)}k tokens` : `${n}
|
|
|
609
612
|
const fmtMeta = (sec, tokens) => `(${fmtDuration(sec)} · ${fmtTokens(tokens)})`;
|
|
610
613
|
const LEDGER_MIN_MS = 30_000; // a turn this long gets a card and a time ledger, tools or not (TUI plan #6)
|
|
611
614
|
const HOLD_RECEIPT_MS = 5_000; // a server that held a request this long before reading says so (TUI plan #7)
|
|
615
|
+
const QUIT_CONFIRM_MS = 2_000; // a second ctrl+c this soon after the first quits
|
|
612
616
|
function Root() {
|
|
613
617
|
const { exit } = useApp();
|
|
614
618
|
const [boot, setBoot] = useState("checking");
|
|
@@ -801,8 +805,8 @@ function Root() {
|
|
|
801
805
|
hooks: settings.hooks, // lifecycle hooks (settings.hooks); inert unless tool hooks are configured
|
|
802
806
|
maxRounds: settings.autonomy?.maxRounds, // soft per-turn round budget (default 200) — a real build isn't cut off at 10
|
|
803
807
|
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)
|
|
804
|
-
compactionThreshold: compactionThreshold(settings), // settings.compaction.threshold / KODE_COMPACTION_THRESHOLD; undefined →
|
|
805
|
-
compactionCeilingTokens: compactionCeilingTokens(settings,
|
|
808
|
+
compactionThreshold: compactionThreshold(settings), // settings.compaction.threshold / KODE_COMPACTION_THRESHOLD; undefined → derived from the served window
|
|
809
|
+
compactionCeilingTokens: compactionCeilingTokens(settings, "interactive"), // the owner's compaction.ceilingTokens / env, else no ceiling. Headless autonomy reads its own (session-factory.ts)
|
|
806
810
|
temperature: settings.temperature,
|
|
807
811
|
recall: settings.memory.recall,
|
|
808
812
|
models: MERGED_MODELS, // discovered fleet nodes + settings.models overrides (built-ins in router/models.ts)
|
|
@@ -814,6 +818,7 @@ function Root() {
|
|
|
814
818
|
features: settings.features, // feature flags — registers flag-gated tools (e.g. cloudAgents) only when on
|
|
815
819
|
activeModel: settings.activeModel, // persisted /model choice, applied at startup
|
|
816
820
|
contextPin: settings.contextPin, // persisted /context · ctrl+x choice (KODE_CONTEXT wins); unset = the served window
|
|
821
|
+
contextFloor: settings.contextFloor,
|
|
817
822
|
permissions: START_POLICY.permissions, // the starting mode's policy (Autonomous, or Gated when the settings say so)
|
|
818
823
|
planReview: START_POLICY.planReview, // Autonomous: the owner reviews plans; risky steps run only if the approved plan lists them
|
|
819
824
|
approve: approveFn, // renders the in-TUI approval prompt for any "ask" decision
|
|
@@ -943,6 +948,7 @@ function Root() {
|
|
|
943
948
|
hooks: settings.hooks, // sub-agents are gated by the same hooks (e.g. git-safety)
|
|
944
949
|
maxRoundsHard: SUBAGENT_ROLES[role]?.maxRounds ?? 50, // role cap (research 20: past it the final-answer repair round makes it answer with what it has); otherwise 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)
|
|
945
950
|
contextPin: sessionRef.current?.contextPin() ?? settings.contextPin, // a sub-agent runs on the owner's current window choice, not the full served one
|
|
951
|
+
contextFloor: settings.contextFloor,
|
|
946
952
|
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")
|
|
947
953
|
cwd, // isolation: a code-editing bg agent gets its own worktree dir here so it can't touch the foreground tree
|
|
948
954
|
temperature: settings.temperature,
|
|
@@ -997,6 +1003,7 @@ function Root() {
|
|
|
997
1003
|
const toolTotal = useRef(0); // cumulative tool calls this session, for /stats
|
|
998
1004
|
const liveText = useRef("");
|
|
999
1005
|
const touchedThisTurn = useRef([]); // files written/edited this turn, for the live progress journal
|
|
1006
|
+
const journaledThisTurn = useRef(false); // a live progress block was written this turn, so it must be settled
|
|
1000
1007
|
const lastNarrationRef = useRef(""); // the narration that preceded the current tool batch (liveText is cleared when the batch starts)
|
|
1001
1008
|
const liveReasoning = useRef(""); // current completion's reasoning ("thinking"), shown dim + above the answer
|
|
1002
1009
|
const liveTokRef = useRef(0); // per-token count accumulated by the stream; flushed to liveTok on the throttled tick
|
|
@@ -1051,6 +1058,15 @@ function Root() {
|
|
|
1051
1058
|
const rcConnectedRef = useRef(false);
|
|
1052
1059
|
rcConnectedRef.current = rcConnected; // a follower attached = someone is watching: the idle monitor reads this
|
|
1053
1060
|
const [rcActive, setRcActive] = useState(false); // remote-control ENABLED/listening (host up) — distinct from rcConnected (a follower is attached); the footer shows OFF(gray) vs ON-waiting(amber) vs LIVE(green)
|
|
1061
|
+
// A host started late, or while a turn runs, opens on what this screen already shows (SPEC/remote-session.md §5: a
|
|
1062
|
+
// snapshot is the full current state): the conversation so far, the turn's activity, the answer streamed up to now.
|
|
1063
|
+
const entriesRef = useRef(entries);
|
|
1064
|
+
entriesRef.current = entries;
|
|
1065
|
+
const seedRemote = (rh) => {
|
|
1066
|
+
rh.seed(entriesRef.current, statusRef.current);
|
|
1067
|
+
if (statusRef.current !== "idle" && (liveText.current || liveReasoning.current))
|
|
1068
|
+
rh.streamAssistant(liveText.current, liveReasoning.current || undefined);
|
|
1069
|
+
};
|
|
1054
1070
|
const setStat = (s) => { statusRef.current = s; setStatus(s); remoteRef.current?.setActivity(s); if (s === "idle") {
|
|
1055
1071
|
touchWork();
|
|
1056
1072
|
setTriage(undefined);
|
|
@@ -1137,7 +1153,12 @@ function Root() {
|
|
|
1137
1153
|
catch { /* preflight is best-effort — fall through to the authoritative health check */ }
|
|
1138
1154
|
// A local Aurora that is not loaded is not a failed boot: it loads on the first turn that needs it, and a
|
|
1139
1155
|
// session on another model (moa, cortana) never needs it.
|
|
1140
|
-
const
|
|
1156
|
+
const primaryOk = reports.find((r) => r.name === "aurora")?.state === "idle" || (await session.health().catch(() => false));
|
|
1157
|
+
// 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). Default model only — moa and
|
|
1159
|
+
// cortana talk to their own endpoint, not this chain.
|
|
1160
|
+
const ok = primaryOk || (session.currentModel() === DEFAULT_MODEL_ID
|
|
1161
|
+
&& (await anyReachable(buildEndpointChain(settings).slice(1).map((e) => e.base)).catch(() => false)));
|
|
1141
1162
|
setBoot(ok ? "ready" : "down");
|
|
1142
1163
|
if (!ok) {
|
|
1143
1164
|
const a = reports.find((r) => r.name === "aurora");
|
|
@@ -1368,6 +1389,7 @@ function Root() {
|
|
|
1368
1389
|
turnStartRef.current = Date.now();
|
|
1369
1390
|
wakeTurnRef.current = opts?.wake === true;
|
|
1370
1391
|
touchedThisTurn.current = [];
|
|
1392
|
+
journaledThisTurn.current = false;
|
|
1371
1393
|
turnCachedRef.current = 0;
|
|
1372
1394
|
rateFeed.startTurn();
|
|
1373
1395
|
actRef.current = {};
|
|
@@ -1397,7 +1419,7 @@ function Root() {
|
|
|
1397
1419
|
expectRef.current = forecast(coldReadsRef.current, label, session.requestTokens());
|
|
1398
1420
|
lastRouteRef.current = label;
|
|
1399
1421
|
transportRef.current = session.modelRegistry().find((m) => m.id === session.currentModel())?.transport;
|
|
1400
|
-
// The owner reads the model, not the leg that answered ("cortana", never "cortana@192.
|
|
1422
|
+
// The owner reads the model, not the leg that answered ("cortana", never "cortana@192.0.2.10:8112");
|
|
1401
1423
|
// /endpoints still lists the legs and their health.
|
|
1402
1424
|
const model = session.currentModel();
|
|
1403
1425
|
setRoute(model);
|
|
@@ -1574,7 +1596,7 @@ function Root() {
|
|
|
1574
1596
|
if (compactionWarnedRef.current)
|
|
1575
1597
|
return;
|
|
1576
1598
|
compactionWarnedRef.current = true;
|
|
1577
|
-
sys(`⚠ auto-compaction failed (${e.skipped === "empty_summary" ? "the summarizer returned nothing" : "the summarizer errored"}) — context stays at ~${Math.round(e.after / 1000)}K tokens; /compact retries, /new starts fresh`);
|
|
1599
|
+
sys(`⚠ auto-compaction failed (${e.skipped === "empty_summary" ? "the summarizer returned nothing" : e.detail ? `the summarizer: ${e.detail}` : "the summarizer errored"}) — context stays at ~${Math.round(e.after / 1000)}K tokens; /compact retries, /new starts fresh`);
|
|
1578
1600
|
},
|
|
1579
1601
|
onLoopCompaction: (e) => {
|
|
1580
1602
|
sys(`↻ loop reset ${e.attempt}: ${e.nudges} loop warnings went unheeded — ` +
|
|
@@ -1643,6 +1665,7 @@ function Root() {
|
|
|
1643
1665
|
// (killed session, wedged model, empty reply) loses nothing the next session cannot resume from.
|
|
1644
1666
|
if (roundProgressed(events)) {
|
|
1645
1667
|
touchedThisTurn.current.push(...touchedPaths(events));
|
|
1668
|
+
journaledThisTurn.current = true;
|
|
1646
1669
|
recordLiveProgress(process.env.KODE_HANDOFF_FILE, { session: SESSION_ID, cwd: process.cwd(), request: text, tasks: getAgentTasks(), touched: touchedThisTurn.current, narration: lastNarrationRef.current });
|
|
1647
1670
|
}
|
|
1648
1671
|
// A round that repeats the last one folds into the live counting line; anything else first settles the fold it ends.
|
|
@@ -1723,9 +1746,10 @@ function Root() {
|
|
|
1723
1746
|
const lastRound = outcome.stopReason === "repetition" ? { chars: liveText.current.length + liveReasoning.current.length, ms: Date.now() - roundStartRef.current } : undefined;
|
|
1724
1747
|
// A completed (not interrupted) turn while still in plan mode counts as "a plan was proposed" —
|
|
1725
1748
|
// arms the exit-time Approve & run picker (see applyMode).
|
|
1726
|
-
// The turn ended normally: settle the live progress block
|
|
1727
|
-
|
|
1728
|
-
|
|
1749
|
+
// The turn ended (normally, or the owner stopped it): settle the live progress block — a plan-only turn too — so the
|
|
1750
|
+
// next session is never told to resume it. Only a turn that died before reaching here stays "resume from this".
|
|
1751
|
+
if (journaledThisTurn.current)
|
|
1752
|
+
settleLiveProgress(process.env.KODE_HANDOFF_FILE, { session: SESSION_ID, cwd: process.cwd(), request: text, tasks: getAgentTasks(), touched: touchedThisTurn.current, narration: lastNarrationRef.current }, outcome.interrupted ? "stopped" : "completed");
|
|
1729
1753
|
if (!outcome.interrupted && session.inPlanMode())
|
|
1730
1754
|
planProposedRef.current = true;
|
|
1731
1755
|
if (outcome.interrupted) {
|
|
@@ -2263,11 +2287,9 @@ function Root() {
|
|
|
2263
2287
|
break;
|
|
2264
2288
|
}
|
|
2265
2289
|
case "artifacts": {
|
|
2266
|
-
// Browse + attach
|
|
2267
|
-
//
|
|
2268
|
-
//
|
|
2269
|
-
// content and re-enters it as a framed user turn (the proven submitRef inject path) so the model
|
|
2270
|
-
// can use it. rename/pin/Shared are Phase 2/3 (need Compose backend work) — see the _ai-docs spec.
|
|
2290
|
+
// Browse + attach the owner's Temple artifacts (products/artifact-library.ts — owner-scoped, the signed-in
|
|
2291
|
+
// Operator token), render the ArtifactPicker, and map each row action to a library call. Attach fetches the
|
|
2292
|
+
// entry page and re-enters it as a framed user turn (the proven submitRef inject path) so the model can use it.
|
|
2271
2293
|
const setPatch = (patch) => setArtifactsPicker((p) => (p ? { ...p, ...patch } : p));
|
|
2272
2294
|
const load = async (fetcher) => {
|
|
2273
2295
|
setPatch({ loading: true, error: undefined, note: undefined });
|
|
@@ -2284,13 +2306,13 @@ function Root() {
|
|
|
2284
2306
|
setArtifactsPicker(null);
|
|
2285
2307
|
break;
|
|
2286
2308
|
case "refresh":
|
|
2287
|
-
await load(() =>
|
|
2309
|
+
await load(() => artifacts.listMine());
|
|
2288
2310
|
break;
|
|
2289
2311
|
case "search":
|
|
2290
|
-
await load(() => (intent.query ?
|
|
2312
|
+
await load(() => (intent.query ? artifacts.search(intent.query) : artifacts.listMine()));
|
|
2291
2313
|
break;
|
|
2292
2314
|
case "copy": {
|
|
2293
|
-
const url =
|
|
2315
|
+
const url = artifacts.viewUrl(intent.id);
|
|
2294
2316
|
try {
|
|
2295
2317
|
const c = execFile(process.platform === "darwin" ? "pbcopy" : process.platform === "win32" ? "clip" : "xclip");
|
|
2296
2318
|
c.stdin?.end(url);
|
|
@@ -2301,9 +2323,9 @@ function Root() {
|
|
|
2301
2323
|
}
|
|
2302
2324
|
case "delete":
|
|
2303
2325
|
try {
|
|
2304
|
-
await
|
|
2326
|
+
await artifacts.del(intent.id);
|
|
2305
2327
|
setPatch({ note: "deleted" });
|
|
2306
|
-
await load(() =>
|
|
2328
|
+
await load(() => artifacts.listMine());
|
|
2307
2329
|
}
|
|
2308
2330
|
catch (e) {
|
|
2309
2331
|
setPatch({ error: e.message });
|
|
@@ -2311,9 +2333,9 @@ function Root() {
|
|
|
2311
2333
|
break;
|
|
2312
2334
|
case "attach":
|
|
2313
2335
|
try {
|
|
2314
|
-
const a = await
|
|
2336
|
+
const a = await artifacts.get(intent.id);
|
|
2315
2337
|
setArtifactsPicker(null);
|
|
2316
|
-
submitRef.current(`[Attached
|
|
2338
|
+
submitRef.current(`[Attached artifact: ${a.title} — ${artifacts.viewUrl(a.id)}]\n\n${a.content}`);
|
|
2317
2339
|
}
|
|
2318
2340
|
catch (e) {
|
|
2319
2341
|
setPatch({ error: e.message });
|
|
@@ -2322,7 +2344,7 @@ function Root() {
|
|
|
2322
2344
|
}
|
|
2323
2345
|
};
|
|
2324
2346
|
setArtifactsPicker({ items: [], loading: true, onIntent });
|
|
2325
|
-
void load(() =>
|
|
2347
|
+
void load(() => artifacts.listMine());
|
|
2326
2348
|
break;
|
|
2327
2349
|
}
|
|
2328
2350
|
case "sessions": {
|
|
@@ -3048,6 +3070,7 @@ function Root() {
|
|
|
3048
3070
|
}
|
|
3049
3071
|
const { relayUrls, hostOf } = await import("./config/product-hosts.js");
|
|
3050
3072
|
const urls = relayUrls(); // api.0perator.co first, api.axe.onl as fallback (KODE_RELAY_URL overrides, comma-separated)
|
|
3073
|
+
let lost = false; // an outage is said once; the re-dials behind it are silent until the relay answers
|
|
3051
3074
|
const rh = new RemoteHost(urls, token, { title: `Operator · ${process.cwd().split("/").pop() || "session"}`, cwd: process.cwd(), host: hostname(), surface: "cli" }, {
|
|
3052
3075
|
onPrompt: remotePrompt, // follower drives a turn (slash-shaped → the allowlisted command path)
|
|
3053
3076
|
onApprovalResponse: (id, approve) => settleApproval(id, approve), // first-wins with local
|
|
@@ -3061,12 +3084,17 @@ function Root() {
|
|
|
3061
3084
|
onCommand: remoteCommand,
|
|
3062
3085
|
onState: (st, detail) => {
|
|
3063
3086
|
setRcConnected(st === "live"); // footer controller icon: green when live, gray otherwise
|
|
3064
|
-
if (st === "live")
|
|
3087
|
+
if (st === "live") {
|
|
3088
|
+
lost = false;
|
|
3065
3089
|
sys(`✷ remote control LIVE via ${hostOf(rh.relayUrl)} — session ${rh.id}\n Continue on your phone or at https://0perator.co/session/${rh.id}\n /remotecontrol again to stop.`);
|
|
3090
|
+
}
|
|
3066
3091
|
// RC v2 A2: a drop is NOT a dead end — the host auto-reconnects to the SAME session id (no
|
|
3067
3092
|
// re-mint). Show the quiet reconnecting state; only a genuine setup error is surfaced hard.
|
|
3068
|
-
else if (st === "connecting" && detail === "reconnecting")
|
|
3069
|
-
|
|
3093
|
+
else if (st === "connecting" && detail === "reconnecting") {
|
|
3094
|
+
if (!lost)
|
|
3095
|
+
sys(rh.id ? "remote control reconnecting… (same session resumes; followers stay attached)" : "remote control can't reach the relay — retrying in the background · /remotecontrol again to stop");
|
|
3096
|
+
lost = true;
|
|
3097
|
+
}
|
|
3070
3098
|
else if (st === "error")
|
|
3071
3099
|
sys(`remote control error: ${detail ?? "connection lost"} — auto-reconnecting`);
|
|
3072
3100
|
else if (st === "closed")
|
|
@@ -3081,6 +3109,7 @@ function Root() {
|
|
|
3081
3109
|
remoteRef.current = rh;
|
|
3082
3110
|
setRcActive(true);
|
|
3083
3111
|
rh.setCapabilities(buildCapabilities()); // cached now, so the very first attach's snapshot already carries it
|
|
3112
|
+
seedRemote(rh);
|
|
3084
3113
|
rh.connect();
|
|
3085
3114
|
sys(`connecting remote control → ${hostOf(rh.relayUrl)} …`);
|
|
3086
3115
|
break;
|
|
@@ -3111,6 +3140,7 @@ function Root() {
|
|
|
3111
3140
|
const { relayUrls, hostOf } = await import("./config/product-hosts.js");
|
|
3112
3141
|
const urls = relayUrls(); // api.0perator.co first, api.axe.onl as fallback (KODE_RELAY_URL overrides, comma-separated)
|
|
3113
3142
|
const code = newCode();
|
|
3143
|
+
let lost = false;
|
|
3114
3144
|
const rh = new RemoteHost(urls, token, { title: `Operator · ${process.cwd().split("/").pop() || "session"}`, cwd: process.cwd(), host: hostname(), surface: "cli" }, {
|
|
3115
3145
|
onPrompt: remotePrompt,
|
|
3116
3146
|
onApprovalResponse: (id, approve) => settleApproval(id, approve),
|
|
@@ -3121,8 +3151,13 @@ function Root() {
|
|
|
3121
3151
|
onCommand: remoteCommand,
|
|
3122
3152
|
onState: (st, detail) => {
|
|
3123
3153
|
setRcConnected(st === "live");
|
|
3124
|
-
if (st === "
|
|
3125
|
-
|
|
3154
|
+
if (st === "live")
|
|
3155
|
+
lost = false;
|
|
3156
|
+
if (st === "connecting" && detail === "reconnecting") {
|
|
3157
|
+
if (!lost)
|
|
3158
|
+
sys("pairing reconnecting… (same session resumes)");
|
|
3159
|
+
lost = true;
|
|
3160
|
+
} // RC v2 A2: auto-reconnect, no re-mint
|
|
3126
3161
|
else if (st === "error")
|
|
3127
3162
|
sys(`pairing error: ${detail ?? "connection lost"} — auto-reconnecting`);
|
|
3128
3163
|
else if (st === "closed")
|
|
@@ -3136,6 +3171,7 @@ function Root() {
|
|
|
3136
3171
|
remoteRef.current = rh;
|
|
3137
3172
|
setRcActive(true);
|
|
3138
3173
|
rh.setCapabilities(buildCapabilities());
|
|
3174
|
+
seedRemote(rh);
|
|
3139
3175
|
rh.connect();
|
|
3140
3176
|
const link = pairURL(code, SESSION_ID);
|
|
3141
3177
|
const qr = await qrToTerminal(link);
|
|
@@ -3166,20 +3202,16 @@ function Root() {
|
|
|
3166
3202
|
// util/slash.ts MIDTURN): read-only ones run now and the turn keeps going; settings the engine reads per request or
|
|
3167
3203
|
// per tool call apply now, from the next step; the rest are staged and run on their own when the turn ends.
|
|
3168
3204
|
const onQueue = useCallback((text) => {
|
|
3169
|
-
const
|
|
3170
|
-
if (
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
push({ kind: "message", message: { id: nextId(), role: "user", content: cmd, tag: cls === "now" ? "↳ ran now · the turn keeps going" : undefined } });
|
|
3175
|
-
void slashRef.current(cmd);
|
|
3176
|
-
return;
|
|
3177
|
-
}
|
|
3178
|
-
setPendingItems([...pendingRef.current, { kind: "command", text: cmd }]);
|
|
3179
|
-
stagedNoteRef.current(cmd);
|
|
3205
|
+
const r = queueRoute(text, statusRef.current !== "idle");
|
|
3206
|
+
if ("run" in r) {
|
|
3207
|
+
// a "next" command's own line says when it applies ("from the next tool call", "from the next step")
|
|
3208
|
+
push({ kind: "message", message: { id: nextId(), role: "user", content: r.run, tag: r.cls === "now" ? "↳ ran now · the turn keeps going" : undefined } });
|
|
3209
|
+
void slashRef.current(r.run);
|
|
3180
3210
|
return;
|
|
3181
3211
|
}
|
|
3182
|
-
setPendingItems([...pendingRef.current,
|
|
3212
|
+
setPendingItems([...pendingRef.current, r.item]);
|
|
3213
|
+
if (r.item.kind === "command")
|
|
3214
|
+
stagedNoteRef.current(r.item.text);
|
|
3183
3215
|
}, []);
|
|
3184
3216
|
// A staged /model <id> says what the switch will cost before the turn even ends, and that Esc gets there sooner.
|
|
3185
3217
|
const stagedNoteRef = useRef(() => { });
|
|
@@ -3481,13 +3513,22 @@ function Root() {
|
|
|
3481
3513
|
}, [applyMode]);
|
|
3482
3514
|
// ctrl+b: move the running shell command to the background so the turn continues. Nothing running → nothing happens.
|
|
3483
3515
|
const onBackground = useCallback(() => { session.detachShell(); }, []);
|
|
3484
|
-
|
|
3485
|
-
|
|
3516
|
+
// Esc only ever interrupts: at rest it does nothing (11/23: a second Esc, pressed to stop a sub-agent's wake-up turn
|
|
3517
|
+
// that had already ended, quit the session). Ctrl-C at rest quits on the second press.
|
|
3518
|
+
const quitArmedRef = useRef(0);
|
|
3519
|
+
const onInterrupt = useCallback((key) => {
|
|
3520
|
+
if (statusRef.current !== "idle")
|
|
3521
|
+
return session.interrupt();
|
|
3522
|
+
const act = restKey(key, quitArmedRef.current, Date.now(), QUIT_CONFIRM_MS);
|
|
3523
|
+
if (act === "quit") {
|
|
3486
3524
|
void teardown.run("quit");
|
|
3487
3525
|
return exit();
|
|
3488
|
-
}
|
|
3489
|
-
|
|
3490
|
-
|
|
3526
|
+
}
|
|
3527
|
+
if (act === "arm") {
|
|
3528
|
+
quitArmedRef.current = Date.now();
|
|
3529
|
+
sys("press ctrl+c again to exit");
|
|
3530
|
+
}
|
|
3531
|
+
}, [exit, sys]);
|
|
3491
3532
|
// Live clock: a lightweight interval ticks `elapsed` while a turn is active, so the timer advances
|
|
3492
3533
|
// even through a long reasoning phase that streams no content tokens (the "timer stuck" bug — Ink
|
|
3493
3534
|
// only re-renders on deltas otherwise). Torn down the moment we go idle. MUST be declared with the
|
|
@@ -3739,10 +3780,11 @@ else {
|
|
|
3739
3780
|
catch { /* best-effort; a write failure just re-shows next boot */ }
|
|
3740
3781
|
}
|
|
3741
3782
|
}
|
|
3742
|
-
|
|
3783
|
+
// Ink would exit on the first ctrl+c itself; the composer owns that key (interrupt mid-turn, twice to quit at rest).
|
|
3784
|
+
const inkInstance = render(_jsx(Root, {}), { exitOnCtrlC: false });
|
|
3743
3785
|
if (FULLSCREEN)
|
|
3744
3786
|
void inkInstance.waitUntilExit().then(leaveAltScreen);
|
|
3745
|
-
// Normal quit (/exit,
|
|
3787
|
+
// Normal quit (/exit, ctrl-c twice at rest): the TUI has unmounted — tear down everything the session owns and WAIT for it (children
|
|
3746
3788
|
// stopped, telemetry delivered or parked in the outbox), then make sure the process really ends. Nothing session-owned is allowed to
|
|
3747
3789
|
// keep Operator alive after the owner has left (that is how duplicate processes piled up); the unref'd timer only ever fires if
|
|
3748
3790
|
// something still holds the event loop open.
|
package/dist/config/features.js
CHANGED
|
@@ -44,12 +44,13 @@ export const FEATURES = {
|
|
|
44
44
|
default: false,
|
|
45
45
|
description: "Race a fast, swappable small model against the real turn; use its answer instead when it wins on a simple, tool-free request",
|
|
46
46
|
},
|
|
47
|
-
/** Deferred tools (tools/deferred.ts native catalog): the main session
|
|
48
|
-
* (NATIVE_CORE_TOOLS) plus tool_search/tool_call; the long tail and every MCP tool
|
|
49
|
-
* those two. The tools array never changes mid-session (cache-safe). Default
|
|
47
|
+
/** Deferred tools (tools/deferred.ts native catalog): the main session attaches a small fixed core
|
|
48
|
+
* (NATIVE_CORE_TOOLS, chosen from real tool use) plus tool_search/tool_call; the long tail and every MCP tool
|
|
49
|
+
* are found and run through those two. The tools array never changes mid-session (cache-safe). Default ON
|
|
50
|
+
* since 2026-11-24 (was OFF) — set it false to attach every tool again. */
|
|
50
51
|
deferredTools: {
|
|
51
|
-
default:
|
|
52
|
-
description: "
|
|
52
|
+
default: true,
|
|
53
|
+
description: "Attach a small core tool set + tool_search/tool_call; the rest are found and run on demand (smaller cached prefix)",
|
|
53
54
|
},
|
|
54
55
|
/** mdoc product (products/mdoc.ts): the model-docs tenant on the shared product rails — versioned, scope-gated
|
|
55
56
|
* knowledge (decisions/specs/handoffs/conventions/chips) models read + write via mdoc_* tools. Default OFF so
|