@0perator/operator 0.1.335 → 0.1.336
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autonomy/delegate.js +5 -2
- package/dist/cli.js +21 -8
- package/dist/config/persona.js +7 -6
- package/dist/router/models.js +10 -6
- package/dist/session.js +13 -1
- package/dist/ui/App.js +10 -2
- package/dist/ui/Composer.js +26 -1
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ export function deriveDelegateSettings(base, profile, endpointOverride) {
|
|
|
72
72
|
endpoints: {
|
|
73
73
|
aurora: {
|
|
74
74
|
base: endpoint,
|
|
75
|
-
model: profile.model ?? profile.id,
|
|
75
|
+
model: endpointOverride ? (profile.model ?? profile.id) : (profile.endpointModels?.[0] ?? profile.model ?? profile.id),
|
|
76
76
|
ctxWindow: profile.ctx ?? base.endpoints.aurora.ctxWindow,
|
|
77
77
|
},
|
|
78
78
|
},
|
|
@@ -120,8 +120,11 @@ export async function runDelegateTask(args, deps = defaultDeps) {
|
|
|
120
120
|
const task = String(args.task ?? "").trim();
|
|
121
121
|
if (!task)
|
|
122
122
|
return "error: delegate_task needs a non-empty `task` — a self-contained subtask; the sub-agent sees nothing else";
|
|
123
|
-
const modelId = String(args.model ?? "").trim() || DEFAULT_DELEGATE_MODEL;
|
|
124
123
|
const settings = await deps.loadSettings();
|
|
124
|
+
// Default sub-agent model is a SETTING (autonomy.delegateModel), not a hardcode, so a new sub-agent can be
|
|
125
|
+
// dropped in by changing one value — the planner still overrides per call via `args.model`.
|
|
126
|
+
const defaultModel = (settings.autonomy?.delegateModel ?? "").trim() || DEFAULT_DELEGATE_MODEL;
|
|
127
|
+
const modelId = String(args.model ?? "").trim() || defaultModel;
|
|
125
128
|
// Gate BYO providers (Claude/OpenAI/Gemini/Qwen/…) on the user actually having stored that provider's key,
|
|
126
129
|
// the same check /model applies — so an unconnected provider fails fast with the actionable "store the key"
|
|
127
130
|
// error BEFORE a sub-agent session is spun up (and before setModel would refuse it anyway, more expensively).
|
package/dist/cli.js
CHANGED
|
@@ -515,6 +515,7 @@ const HELP = [
|
|
|
515
515
|
" /clear clear the screen (keeps the conversation)",
|
|
516
516
|
" /exit /quit leave operator",
|
|
517
517
|
"esc — interrupt a running turn (or quit when idle)",
|
|
518
|
+
"while a turn runs: enter queues a message · esc sends it now · ↑ on an empty input edits the last queued · backspace on an empty input cancels it",
|
|
518
519
|
].join("\n");
|
|
519
520
|
// Slash commands a remote-control FOLLOWER is allowed to drive (RemoteHost `command` frame →
|
|
520
521
|
// SPEC/remote-session.md extension; see REMOTE_RICH_HEAD_AUDIT.md). This is BOTH the allowlist enforced
|
|
@@ -793,8 +794,8 @@ function Root() {
|
|
|
793
794
|
setLive(has ? { kind: "message", message: { id: "live", role: "assistant", content: liveText.current, reasoning: liveReasoning.current || undefined } } : null);
|
|
794
795
|
setLiveTok(liveTokRef.current);
|
|
795
796
|
}, 64)).current;
|
|
796
|
-
const queued = useRef(
|
|
797
|
-
const [queuedPreview, setQueuedPreview] = useState(
|
|
797
|
+
const queued = useRef([]); // type-while-thinking messages, oldest first; drained as one turn when the turn ends
|
|
798
|
+
const [queuedPreview, setQueuedPreview] = useState([]); // reactive mirror of the queue, shown above the composer so a type-while-thinking message is VISIBLE
|
|
798
799
|
const statusRef = useRef("idle");
|
|
799
800
|
// Remote-control host (SPEC/remote-session.md): non-null only while /remotecontrol is active. Every
|
|
800
801
|
// state mutation below also mirrors to it so attached followers see identical transcript/tool/activity.
|
|
@@ -1250,9 +1251,9 @@ function Root() {
|
|
|
1250
1251
|
// Re-check capabilities after every turn: MCP discovery (first-turn only) may have just landed,
|
|
1251
1252
|
// and any skill_fetch/skill_save this turn updated skillsRef above. A no-op diff never hits the wire.
|
|
1252
1253
|
remoteRef.current?.setCapabilities(buildCapabilities());
|
|
1253
|
-
const q = queued.current;
|
|
1254
|
-
queued.current =
|
|
1255
|
-
setQueuedPreview(
|
|
1254
|
+
const q = queued.current.join("\n");
|
|
1255
|
+
queued.current = [];
|
|
1256
|
+
setQueuedPreview([]);
|
|
1256
1257
|
if (q)
|
|
1257
1258
|
submitRef.current(q);
|
|
1258
1259
|
else
|
|
@@ -1268,7 +1269,7 @@ function Root() {
|
|
|
1268
1269
|
const jobs = getJobNoticeMode() === "wake" && pendingJobNotices() > 0;
|
|
1269
1270
|
if (!jobs && pendingAgentReports() === 0)
|
|
1270
1271
|
return;
|
|
1271
|
-
if (statusRef.current !== "idle" || queued.current)
|
|
1272
|
+
if (statusRef.current !== "idle" || queued.current.length)
|
|
1272
1273
|
return;
|
|
1273
1274
|
void sendTurn("", { wake: true });
|
|
1274
1275
|
};
|
|
@@ -2468,7 +2469,19 @@ function Root() {
|
|
|
2468
2469
|
void sendTurn(text);
|
|
2469
2470
|
}, [sendTurn, handleSlash]);
|
|
2470
2471
|
submitRef.current = onSubmit;
|
|
2471
|
-
const onQueue = useCallback((text) => { queued.current = queued.current
|
|
2472
|
+
const onQueue = useCallback((text) => { queued.current = [...queued.current, text]; setQueuedPreview(queued.current); }, []);
|
|
2473
|
+
// ↑ / Backspace on an empty draft act on the most recent queued message: edit pops it back into the draft (Enter
|
|
2474
|
+
// re-queues it, or sends it if the turn has ended); drop discards it and echoes the full text so nothing vanishes silently.
|
|
2475
|
+
const popQueued = useCallback(() => {
|
|
2476
|
+
const text = queued.current.at(-1);
|
|
2477
|
+
if (text === undefined)
|
|
2478
|
+
return undefined;
|
|
2479
|
+
queued.current = queued.current.slice(0, -1);
|
|
2480
|
+
setQueuedPreview(queued.current);
|
|
2481
|
+
return text;
|
|
2482
|
+
}, []);
|
|
2483
|
+
const onDropQueued = useCallback(() => { const text = popQueued(); if (text !== undefined)
|
|
2484
|
+
sys(`queued message cancelled (not sent): ${text}`); }, [popQueued, sys]);
|
|
2472
2485
|
// Shift+Tab cycles the operating mode (matches Claude Code). auto→manual→plan→auto. Auto drives with
|
|
2473
2486
|
// no approval gate; Manual gates mutating tools through the approve() bridge; Plan is read-only research.
|
|
2474
2487
|
const onCycleMode = useCallback(() => {
|
|
@@ -2591,7 +2604,7 @@ function Root() {
|
|
|
2591
2604
|
? `${spin} reading your prompt… (${fmtDuration(elapsed)})`
|
|
2592
2605
|
: `${spin} ${fmtMeta(elapsed, liveTok)}`
|
|
2593
2606
|
: metrics;
|
|
2594
|
-
return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, prefill: prefill, liveTools: liveTools, route: route, ctxPct: ctxPct, ctxPin: ctxPin ? fmtCtx(ctxPin) : undefined, 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, onCycleContext: onCycleContext, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, caffeinated: caffeinated, approval: approval, question: question, modelPicker: modelPicker, secretPrompt: secretPrompt, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, onApprovalDecide: (allow, always) => {
|
|
2607
|
+
return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, prefill: prefill, liveTools: liveTools, route: route, ctxPct: ctxPct, ctxPin: ctxPin ? fmtCtx(ctxPin) : undefined, 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, onEditQueued: popQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onCycleMode: onCycleMode, onCycleContext: onCycleContext, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, caffeinated: caffeinated, approval: approval, question: question, modelPicker: modelPicker, secretPrompt: secretPrompt, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, onApprovalDecide: (allow, always) => {
|
|
2595
2608
|
const cur = approval;
|
|
2596
2609
|
if (cur)
|
|
2597
2610
|
settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
|
package/dist/config/persona.js
CHANGED
|
@@ -212,12 +212,13 @@ export function basePersona(cwd = process.cwd(), opts = {}) {
|
|
|
212
212
|
`git-ignored and swept after a week, so nothing you keep belongs in it; name files \`<subject>-<thing>\`.` +
|
|
213
213
|
ctxLine +
|
|
214
214
|
`\n## Talking about yourself\nYou are Operator, whichever model is serving you — the model underneath can change between sessions (or mid-session with /model) and you are still Operator. When asked what you are or which model you run on, ` +
|
|
215
|
-
`say you are Operator (AXE's agent)
|
|
216
|
-
`
|
|
217
|
-
`("running on <host> at <ip>:<port>") unless the owner asks where it
|
|
218
|
-
`
|
|
219
|
-
`
|
|
220
|
-
`\n## Don't starve the serving model — decode is RAM-bound\nYour
|
|
215
|
+
`say you are Operator (AXE's agent) running on the model named in the "Active model" section at the end of this prompt, and give ` +
|
|
216
|
+
`the context window above. Never guess the model from files, hostnames or other text in this prompt, and do not recite hostnames, ` +
|
|
217
|
+
`IP addresses, ports, URLs or file paths for a model's server ("running on <host> at <ip>:<port>") unless the owner asks where it ` +
|
|
218
|
+
`runs or you need the address to do the task. If the owner greets you by a model name ("hello cortana"), answer as Operator in ` +
|
|
219
|
+
`the first person, briefly, and say which model is actually serving when it differs.` +
|
|
220
|
+
`\n## Don't starve the serving model — decode is RAM-bound\nYour model is served on a fleet box (the "Active model" section names ` +
|
|
221
|
+
`it), and the models served on THIS box are RAM-bound too. ` +
|
|
221
222
|
`Loading another large model into memory here (a multi-GB MLX/FLUX/LLM checkpoint, a big \`ml.load\`) competes ` +
|
|
222
223
|
`for RAM, pushes the box into swap, and collapses your decode to ~1 token/sec — a turn then grinds for an hour ` +
|
|
223
224
|
`producing almost nothing. Before loading heavy weights on this box: do it on a different node if one is ` +
|
package/dist/router/models.js
CHANGED
|
@@ -24,10 +24,14 @@ export const MODEL_ALIASES = {
|
|
|
24
24
|
"aurora-128k": "operator-128k",
|
|
25
25
|
"spectre": "cortana", // flagship renamed Spectre -> Cortana 35B (2026-10-07); old id keeps resolving
|
|
26
26
|
};
|
|
27
|
-
/** AXE's one shared model gateway (Caddy + AuthGate op_ verify
|
|
28
|
-
*
|
|
29
|
-
* (router/portal.ts) derives its host from this too, so the address lives in exactly one place. */
|
|
27
|
+
/** AXE's one shared model gateway, public face (Caddy + AuthGate op_ verify in front of the portal router, JL2).
|
|
28
|
+
* The portal client (router/portal.ts) derives its host from this too, so the address lives in exactly one place. */
|
|
30
29
|
export const GATEWAY_BASE = `https://${PRODUCT_API_HOST}/v1`;
|
|
30
|
+
/** The same gateway on this box's loopback. Fleet entries list it FIRST and the public face second, so a local
|
|
31
|
+
* agent never round-trips through the Cloudflare tunnel (one Cortana turn: 107 s via the edge, 16 s local) and
|
|
32
|
+
* every model goes through the gateway, never a box's raw LAN port. A box without a local gateway fails this leg
|
|
33
|
+
* at connect and falls through to the public face. */
|
|
34
|
+
export const LOCAL_GATEWAY_BASE = process.env.KODE_LOCAL_GATEWAY_URL ?? "http://127.0.0.1:8620/v1";
|
|
31
35
|
/** The legacy fleet name for the SAME gateway — the ordered fallback behind GATEWAY_BASE, never a different backend. */
|
|
32
36
|
export const LEGACY_GATEWAY_BASE = `https://${LEGACY_API_HOST}/v1`;
|
|
33
37
|
// Vendor bases shared by the built-in BYO rows and BYO_PRESETS, so a row and its preset can never drift apart.
|
|
@@ -60,17 +64,17 @@ export const BUILTIN_MODELS = [
|
|
|
60
64
|
// ctx 262144 = the served n_ctx (JL1 /props, verified 2026-10-28). The 0.1.260 lesson stands: a profile that
|
|
61
65
|
// claims MORE than the server's --ctx-size makes the engine overrun the wall and the server cuts a round
|
|
62
66
|
// mid-tool-call (0.1.259) — change this number ONLY when the server's --ctx-size changes.
|
|
63
|
-
{ id: "cortana", tier: "power", label: "Cortana", params: "35B-A3B", box: "JL1", kind: "single", desc: "Qwen3.6-35B-A3B abliterated, Q4_K_M", endpoint:
|
|
67
|
+
{ id: "cortana", tier: "power", label: "Cortana", params: "35B-A3B", box: "JL1", kind: "single", desc: "Qwen3.6-35B-A3B abliterated, Q4_K_M", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["cortana", "cortana"], model: "/Volumes/Ai Storage/jl1-local/models/aurorax/Huihui-Qwen3.6-35B-A3B-abliterated.Q4_K_M.gguf", ctx: 262144 },
|
|
64
68
|
// Thor — huihui-ai QwQ-32B abliterated: a dense reasoning model that thinks before it answers. Served on JL1:8124
|
|
65
69
|
// (the portal lists it "available" = registered, loaded on demand); gateway-first like cortana. ctx 32768 = the
|
|
66
70
|
// server's --ctx-size. Mirrors the hand override JL2's settings.json carried under this id (now a no-op by id).
|
|
67
|
-
{ id: "thor", tier: "power", label: "Thor", params: "32B", box: "JL1", kind: "single", desc: "QwQ-32B abliterated reasoning model — thinks before answering", endpoint:
|
|
71
|
+
{ id: "thor", tier: "power", label: "Thor", params: "32B", box: "JL1", kind: "single", desc: "QwQ-32B abliterated reasoning model — thinks before answering", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["thor", "thor"], model: "/Volumes/Ai Storage/axe-models/thor-32b/huihui-ai_QwQ-32B-abliterated-Q4_K_M.gguf", ctx: 32768 },
|
|
68
72
|
// Qwen3-4B — fast LOCAL tier (stock qwen3-4b-mlx-q4, 2.26GB MLX 4-bit, ctx 40960) served via mlx_lm.server
|
|
69
73
|
// on JL1:8110. Qwen3 vocab (151936) — the same family as ghost-32b, so it's the review-recommended quick tier
|
|
70
74
|
// AND the vocab lineage for ghost spec-decode (the actual draft is Qwen3-0.6B, too small to list here). Runs
|
|
71
75
|
// /no_think for speed. Picked (2026-10-07) from a fleet-wide 3B-class review; no 3B had been execution-graded,
|
|
72
76
|
// so this is the evidence-led default pending a dyno/coding-eval bench. 40960 ≥ LEAN_HARNESS_CTX → full harness.
|
|
73
|
-
{ id: "scout", tier: "lite", label: "Scout", params: "4B", box: "JL1", kind: "single", desc: "fast local tier — Qwen3-4B /no_think, Qwen3 vocab (JL1:8110, MLX 4-bit; gateway
|
|
77
|
+
{ id: "scout", tier: "lite", label: "Scout", params: "4B", box: "JL1", kind: "single", desc: "fast local tier — Qwen3-4B /no_think, Qwen3 vocab (JL1:8110, MLX 4-bit; local gateway first, public gateway as failover)", endpoint: LOCAL_GATEWAY_BASE, endpoints: [LOCAL_GATEWAY_BASE, GATEWAY_BASE], endpointModels: ["scout", "scout"], model: "/Volumes/Ai Storage/axe-models/qwen3-4b-mlx-q4", ctx: 32000 },
|
|
74
78
|
// Falcon-H1-34B — a NOVEL architecture nobody else on the fleet runs: hybrid SSM+attention, trained with a
|
|
75
79
|
// genuinely long native context (no YaRN stretch needed — 262144 is baked into the GGUF's own metadata,
|
|
76
80
|
// confirmed via gguf-py header read, rope.freq_base ≈1e11). Served JL1:8101, q8_0 KV, parallel=1. Not one
|
package/dist/session.js
CHANGED
|
@@ -485,6 +485,17 @@ export class Session {
|
|
|
485
485
|
});
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
|
+
/** Which model is actually serving, rebuilt every turn so it follows /model. Last in the prompt and marked
|
|
489
|
+
* authoritative, because a SOUL.md or AGENTS.md naming the box's usual model once made Cortana answer "I'm Aurora". */
|
|
490
|
+
activeModelBlock() {
|
|
491
|
+
const p = this.liveRegistry().find((m) => m.id === this.modelId);
|
|
492
|
+
const name = p ? `${p.label}${p.params ? ` ${p.params}` : ""}` : this.modelId;
|
|
493
|
+
return `\n\n## Active model\nThis session is served by ${name}${p?.box ? ` on ${p.box}` : ""} (model id \`${this.modelId}\`). ` +
|
|
494
|
+
`This is authoritative: it overrides any model named elsewhere in this prompt or in project files, and it changes ` +
|
|
495
|
+
`when the owner runs /model. Asked which model you run on, say you are Operator running on ${name}.` +
|
|
496
|
+
`\n\n## Working directory\n${this.cwd ?? process.cwd()}\nRelative paths and shell commands resolve here. This is ` +
|
|
497
|
+
`authoritative over any working dir named elsewhere in this prompt; create files here unless the owner names another path.`;
|
|
498
|
+
}
|
|
488
499
|
/** The effective system prompt: the base persona plus any memory recalled this session, plus any
|
|
489
500
|
* active skill. Injected as ONE system prompt — never a second system message, which 400s llama.cpp's
|
|
490
501
|
* chat template. */
|
|
@@ -494,6 +505,7 @@ export class Session {
|
|
|
494
505
|
: this.systemPrompt;
|
|
495
506
|
if (this.activeSkillBlock)
|
|
496
507
|
base = (base ?? "") + this.activeSkillBlock;
|
|
508
|
+
base = (base ?? "") + this.activeModelBlock();
|
|
497
509
|
if (!this.planMode)
|
|
498
510
|
return base;
|
|
499
511
|
// Plan mode: the model researches read-only and proposes a plan; the read-only enforcement is in
|
|
@@ -1321,7 +1333,7 @@ export class Session {
|
|
|
1321
1333
|
const shadowBase = prof?.endpoint && prof.transport !== "anthropic" ? endpointBase(prof.endpoint) : undefined;
|
|
1322
1334
|
if (shadowBase) {
|
|
1323
1335
|
const shadowTok = prof?.byo ? getByoToken(prof.byo, prof.endpoint) : undefined;
|
|
1324
|
-
const shadowModel = prof?.model ?? this.modelId;
|
|
1336
|
+
const shadowModel = prof?.endpointModels?.[0] ?? prof?.model ?? this.modelId;
|
|
1325
1337
|
this._shadowPending = routeShadowTurn({
|
|
1326
1338
|
enabled: true,
|
|
1327
1339
|
text,
|
package/dist/ui/App.js
CHANGED
|
@@ -28,6 +28,14 @@ import { SessionPicker } from "./SessionPicker.js";
|
|
|
28
28
|
// the non-Static portion approaches the terminal height). A batch rarely runs more than a handful of
|
|
29
29
|
// calls at once; anything past the cap is summarized as a count instead of another row.
|
|
30
30
|
const MAX_LIVE_TOOL_ROWS = 6;
|
|
31
|
+
/** The yellow line above the composer while messages wait for the turn to end: count, the keys that act on the queue,
|
|
32
|
+
* then a one-line preview of everything queued (newlines as " / ", capped at 120 chars). */
|
|
33
|
+
export function queuedHint(queued) {
|
|
34
|
+
const preview = queued.join("\n").replace(/\n/g, " / ");
|
|
35
|
+
const head = queued.length > 1 ? `⏎ ${queued.length} queued · send together when this turn ends` : "⏎ queued · sends when this turn ends";
|
|
36
|
+
const keys = queued.length > 1 ? "Esc send now · ↑ edit last · ⌫ cancel last" : "Esc send now · ↑ edit · ⌫ cancel";
|
|
37
|
+
return `${head} · ${keys}: ${preview.slice(0, 120)}${preview.length > 120 ? "…" : ""}`;
|
|
38
|
+
}
|
|
31
39
|
// Muted "ctrl+b to run in the background" tail on the phase line, once a shell command has run past ~2s. Ticks
|
|
32
40
|
// on the shared animation clock only while a shell command is running, so it appears without any other event.
|
|
33
41
|
function BackgroundHint({ rows }) {
|
|
@@ -37,7 +45,7 @@ function BackgroundHint({ rows }) {
|
|
|
37
45
|
return hint ? _jsx(Text, { dimColor: true, children: ` · ${hint}` }) : null;
|
|
38
46
|
}
|
|
39
47
|
export function App(props) {
|
|
40
|
-
const { messages, live = null, status, thinkingVerb, verbs, stepLabel, prefill = "", liveTools = [], route, ctxPct, ctxPin, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], onBackground, tasks = [], onSubmit, onQueue, queuedPreview =
|
|
48
|
+
const { messages, live = null, status, thinkingVerb, verbs, stepLabel, prefill = "", liveTools = [], route, ctxPct, ctxPin, version, build, fullscreen = false, metrics, sessionTokens, authUser, tier, planMode, thinkMode, bgAgents, shellJobs = [], onBackground, tasks = [], onSubmit, onQueue, queuedPreview = [], onEditQueued, onDropQueued, onInterrupt, onCycleMode, onCycleContext, opMode, rcConnected = false, rcActive = false, caffeinated = false, approval = null, onApprovalDecide, question = null, modelPicker = null, secretPrompt = null, planExitPicker = null, artifactsPicker = null, sessionsPicker = null } = props;
|
|
41
49
|
useTerminalSize(); // subscribe so the inline pinned UI (status rule, composer, footer) reflows the instant the terminal resizes
|
|
42
50
|
const thinking = status === "thinking" || status === "streaming";
|
|
43
51
|
// A parallel batch (2+ live rows) gets its own per-call view instead of the single-line StepSpinner —
|
|
@@ -52,7 +60,7 @@ export function App(props) {
|
|
|
52
60
|
// be scrolled off. The Composer is `suspended` (keystrokes route to the decision, not the draft).
|
|
53
61
|
const prompts = (_jsxs(_Fragment, { children: [_jsx(ApprovalPrompt, { approval: approval, onDecide: onApprovalDecide ?? (() => { }) }), _jsx(QuestionPrompt, { pending: question }), _jsx(QuestionPrompt, { pending: modelPicker }), _jsx(SecretPrompt, { pending: secretPrompt }), _jsx(QuestionPrompt, { pending: planExitPicker }), _jsx(ArtifactPicker, { pending: artifactsPicker }), _jsx(SessionPicker, { pending: sessionsPicker })] }));
|
|
54
62
|
// The pinned bottom band: status rule, composer, bottom rule, then the mode/cycle FOOTER below the rule.
|
|
55
|
-
const bottom = (_jsxs(_Fragment, { children: [_jsx(StatusRule, { route: route, ctxPct: ctxPct, ctxPin: ctxPin, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), queuedPreview ?
|
|
63
|
+
const bottom = (_jsxs(_Fragment, { children: [_jsx(StatusRule, { route: route, ctxPct: ctxPct, ctxPin: ctxPin, version: version, build: build, user: authUser, tier: tier, planMode: planMode, thinkMode: thinkMode, sessionTokens: sessionTokens }), queuedPreview.length ? _jsx(Text, { color: "yellow", children: queuedHint(queuedPreview) }) : null, _jsx(Composer, { onSubmit: onSubmit, onQueue: onQueue, queued: queuedPreview.length, onEditQueued: onEditQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onBackground: onBackground, onCycleMode: onCycleMode, onCycleContext: onCycleContext, disabled: status !== "idle", suspended: !!approval || !!question || !!modelPicker || !!secretPrompt || !!planExitPicker || !!artifactsPicker || !!sessionsPicker }), _jsx(InputRule, {}), opMode && (_jsxs(Box, { justifyContent: "space-between", children: [_jsx(Text, { dimColor: true, children: ` ${opMode === "auto" ? "⎈ Autonomous" : opMode === "manual" ? "⊙ Manual" : "◑ Plan"} · shift+tab to cycle` }), _jsx(Text, { color: rcConnected ? "green" : rcActive ? "yellow" : "gray", bold: rcConnected || rcActive, dimColor: !rcConnected && !rcActive, children: `${caffeinated ? "☕ " : ""}${rcConnected ? "▮ rc live" : rcActive ? "▮ rc on" : "▯ rc"} ` })] }))] }));
|
|
56
64
|
// Fullscreen (opt-in): a full-terminal-height column. The transcript fills a clipped, bottom-anchored
|
|
57
65
|
// region (non-Static tail) so the newest output sits just above a composer pinned to the very bottom —
|
|
58
66
|
// no dead space. Off by default: inline keeps the terminal's native scrollback (mouse-scroll + copy).
|
package/dist/ui/Composer.js
CHANGED
|
@@ -21,7 +21,7 @@ import { matchSlashCommands } from "./slashCommands.js";
|
|
|
21
21
|
import { touchInput } from "../idle/activity.js";
|
|
22
22
|
const PASTE_START = "\x1b[200~";
|
|
23
23
|
const PASTE_END = "\x1b[201~";
|
|
24
|
-
export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended, onCycleMode, onCycleContext, onBackground, prompt = "› " }) {
|
|
24
|
+
export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended, onCycleMode, onCycleContext, onBackground, queued = 0, onEditQueued, onDropQueued, prompt = "› " }) {
|
|
25
25
|
const [value, setValue] = useState("");
|
|
26
26
|
const suspendedRef = useRef(suspended); // read by the raw-stdin paste listener, registered once below
|
|
27
27
|
suspendedRef.current = suspended;
|
|
@@ -194,6 +194,19 @@ export function Composer({ onSubmit, onInterrupt, onQueue, disabled, suspended,
|
|
|
194
194
|
onSubmit(text);
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
|
+
// Queued messages (Claude Code's ↑-to-edit): on an empty draft ↑ pulls the most recent one back for editing and
|
|
198
|
+
// Backspace drops it. Ahead of history recall, which gets ↑ back once the queue is empty.
|
|
199
|
+
const queuedPlan = queuedKeyPlan(key, { draftEmpty: value === "", queued });
|
|
200
|
+
if (queuedPlan === "edit") {
|
|
201
|
+
const text = onEditQueued?.();
|
|
202
|
+
if (text !== undefined)
|
|
203
|
+
setValue(text);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (queuedPlan === "drop") {
|
|
207
|
+
onDropQueued?.();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
197
210
|
// ↑/↓ navigate the "/" menu when it's open — takes priority over history recall so arrows move the
|
|
198
211
|
// highlight instead of clobbering the "/command" draft. Wraps around.
|
|
199
212
|
if ((key.upArrow || key.downArrow) && menuMatches.length > 0) {
|
|
@@ -332,6 +345,18 @@ export function interruptPlan(key, ctx) {
|
|
|
332
345
|
return { flushDraft: false, interrupt: true };
|
|
333
346
|
return { flushDraft: false, interrupt: false };
|
|
334
347
|
}
|
|
348
|
+
/** Pure decision for ↑ / Backspace while messages are queued. Only an EMPTY draft is eligible, so typing, deleting
|
|
349
|
+
* and history recall are untouched while there is text in the box: ↑ = "edit" (pop the most recent queued message
|
|
350
|
+
* into the draft), Backspace/Delete = "drop" (discard it). Anything else, or an empty queue, is null. */
|
|
351
|
+
export function queuedKeyPlan(key, ctx) {
|
|
352
|
+
if (!ctx.draftEmpty || ctx.queued <= 0)
|
|
353
|
+
return null;
|
|
354
|
+
if (key.upArrow)
|
|
355
|
+
return "edit";
|
|
356
|
+
if (key.backspace || key.delete)
|
|
357
|
+
return "drop";
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
335
360
|
/** ctrl+b, or its tmux-safe alias ctrl+z (the shell's own "send to background" key). */
|
|
336
361
|
export function isBackgroundKey(ch, key) {
|
|
337
362
|
return !!key.ctrl && (ch === "b" || ch === "z");
|