chore: refresh stale comments, drop dead passKey

Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
FactorandOvis Fast committed 2026-11-19 12:10:53 +01:00
1 parent dfe5101451
commit d0dda5b670
2 files changed
+23 -36

No files matched your search

+20 -33
View File
@@ -1,18 +1,23 @@
// main.js - the composer: the visible message bar under the terminal.
//
// The field, the queue above it, the suggestion menu, the attachments, the
// context strip and the agent chip. What needs no GPUI lives in view.js
// (tests/main.test.mjs); the state model is state.js, the sending is
// delivery.js, the suggestions are suggest.js and catalog.js, the limits are
// attachments.js and the persistence is storage.js.
// context strip and the agent pill. What needs no GPUI lives in view.js
// (tests/view.test.mjs); the state model is state.js, the sending is
// delivery.js, the suggestions are suggest.js and catalog.js, the limits and
// the clipboard are attachments.js and clipboard.js, the history is history.js
// (drawn by panel.js) and the persistence is storage.js.
//
// The composer talks to one agent at a time - the focused one. Everything that
// belongs to an agent (the draft, the queue, the attachments) is keyed by the
// agent's address, so switching agents never mixes two of them.
//
// The keyboard belongs to the composer: the terminal only shows. The field
// takes the keyboard back when it loses it, and the shortcuts that belong to
// the agent's own program (Ctrl+C, Esc) are passed on with `hc`.
// Focus follows the click: the composer never takes the keyboard on its own.
// The field has it after a click on it or after Ctrl+Shift+Space (the "focus"
// command); a click in a terminal gives the keys to that terminal. While the
// field has the keyboard its shortcuts (Enter, Ctrl+Enter, Alt+Enter, Esc,
// Ctrl+R, the arrows and Tab of the menu) are bound in the context
// `ovis-composer > Input`. The agent is stopped with the Stop button or Esc on
// an empty field (`hc interrupt`).
//
// `hc send` does not confirm a delivery - it pastes the text and presses
// Enter. The composer says "Wysłano do terminala" and takes the confirmation
@@ -927,20 +932,13 @@ export default class Composer extends View {
if (handled || String(event.key).toLowerCase() === "escape") cx.stop_propagation();
}
/**
* The menu moves one row up or down.
*
* The arrows come as actions of the mod: the field binds them to the
* movement of the cursor and eats them before they reach the element. The
* cursor goes back to where the menu was opened, so the text does not move
* under the person.
*/
/**
* The up and down arrows.
*
* With the menu open they move the menu; without it they move the cursor
* between the lines of the field - the field of this app version does not do
* that by itself.
* They come as actions of the mod: the field binds them to its own cursor
* movement and eats them before they reach the element. With the menu open
* they move the menu; without it they move the cursor between the lines of
* the field - the field of this app version does not do that by itself.
*/
arrow(step, cx) {
if (!this.hasKeyboard) return;
@@ -959,6 +957,10 @@ export default class Composer extends View {
this.textarea.set_selected_range({ start: moved, end: moved });
}
/**
* The menu moves one row. The cursor goes back to where the menu was opened,
* so the text does not move under the person.
*/
moveMenu(step, cx) {
if (menuAction(this.hasKeyboard, this.menu, step < 0 ? "up" : "down") !== "menu") return;
const menu = this.menu;
@@ -1590,21 +1592,6 @@ export default class Composer extends View {
});
}
/** The shortcut of the agent's own program - the keyboard here is not the terminal's. */
passKey(agent, keys, cx) {
cx.spawn(async (cx) => {
try {
const res = await hc(["keys", agent.address, keys, "--json"]);
if (!hcOk(res)) {
this.notice(`Klawisz nie dotarł do agenta: ${resultError(res, parseJson(res.stdout))}`, "error");
}
} catch {
// The core is gone - the key goes nowhere.
}
cx.notify();
});
}
// --- the suggestions -----------------------------------------------------
/** The caret sits in a `/` or `@` token - the menu looks at it. */