chore: refresh stale comments, drop dead passKey
Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
1 parent
dfe5101451
commit
d0dda5b670
2 files changed
+23
-36
No files matched your search
+20
-33
@@ -1,18 +1,23 @@
|
|||||||
// main.js - the composer: the visible message bar under the terminal.
|
// main.js - the composer: the visible message bar under the terminal.
|
||||||
//
|
//
|
||||||
// The field, the queue above it, the suggestion menu, the attachments, the
|
// 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
|
// context strip and the agent pill. What needs no GPUI lives in view.js
|
||||||
// (tests/main.test.mjs); the state model is state.js, the sending is
|
// (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 are
|
// delivery.js, the suggestions are suggest.js and catalog.js, the limits and
|
||||||
// attachments.js and the persistence is storage.js.
|
// 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
|
// 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
|
// 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.
|
// agent's address, so switching agents never mixes two of them.
|
||||||
//
|
//
|
||||||
// The keyboard belongs to the composer: the terminal only shows. The field
|
// Focus follows the click: the composer never takes the keyboard on its own.
|
||||||
// takes the keyboard back when it loses it, and the shortcuts that belong to
|
// The field has it after a click on it or after Ctrl+Shift+Space (the "focus"
|
||||||
// the agent's own program (Ctrl+C, Esc) are passed on with `hc`.
|
// 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
|
// `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
|
// 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();
|
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.
|
* The up and down arrows.
|
||||||
*
|
*
|
||||||
* With the menu open they move the menu; without it they move the cursor
|
* They come as actions of the mod: the field binds them to its own cursor
|
||||||
* between the lines of the field - the field of this app version does not do
|
* movement and eats them before they reach the element. With the menu open
|
||||||
* that by itself.
|
* 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) {
|
arrow(step, cx) {
|
||||||
if (!this.hasKeyboard) return;
|
if (!this.hasKeyboard) return;
|
||||||
@@ -959,6 +957,10 @@ export default class Composer extends View {
|
|||||||
this.textarea.set_selected_range({ start: moved, end: moved });
|
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) {
|
moveMenu(step, cx) {
|
||||||
if (menuAction(this.hasKeyboard, this.menu, step < 0 ? "up" : "down") !== "menu") return;
|
if (menuAction(this.hasKeyboard, this.menu, step < 0 ? "up" : "down") !== "menu") return;
|
||||||
const menu = this.menu;
|
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 suggestions -----------------------------------------------------
|
||||||
|
|
||||||
/** The caret sits in a `/` or `@` token - the menu looks at it. */
|
/** The caret sits in a `/` or `@` token - the menu looks at it. */
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
// never mutates the one it was given, so the model can be tested in plain Node
|
// never mutates the one it was given, so the model can be tested in plain Node
|
||||||
// (tests/state.test.mjs) and reasoned about without a running app.
|
// (tests/state.test.mjs) and reasoned about without a running app.
|
||||||
//
|
//
|
||||||
// Drafts, attachments and the queue are keyed by agent name ("claude-code",
|
// Drafts, attachments and the queue are keyed by the address of the agent
|
||||||
// "codex"): each belongs to the agent it was written for, and switching agents
|
// (`AgentInfo.address`, e.g. "t2"): each belongs to the agent it was written
|
||||||
// must not lose any of them.
|
// for, and switching agents must not lose any of them.
|
||||||
|
|
||||||
import { onRestart } from "./delivery.js";
|
import { onRestart } from "./delivery.js";
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user