Ideen aus termilly, Pakete B–D: Diff, Gegenprüfung, Aufgaben, alte Ausgabe, KI-Prüfung, Handy-Meldungen, Panels andocken (#177)

* Änderungen ansehen, Gegenprüfung durch zweite KI, Aufgaben je Verbindung/Ordner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjduFQLMDK2DdJ2Gjg

* Ausgabe vom letzten Mal, Zuletzt geschlossen, KI-Prüfung als Zeitplan, Handy-Meldungen (ntfy, Gotify, Webhook)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjduFQLMDK2DdJ2Gjg

* Panel links/rechts/unten mit Größe per Maus, F5 und Log-Blick neben dem Terminal, Statuszeile je Bereich

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjduFQLMDK2DdJ2Gjg

* Test Verlaufsspeicher: Messung ohne Unterlauf, wenn der Heap schrumpft

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUjduFQLMDK2DdJ2Gjg

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
db9979andClaude Opus 5.5 authored and GitHub committed 2026-11-20 22:09:04 +01:00
1 parent 04a801517c
commit d7c105cc87
79 files changed
+3655 -129

No files matched your search

+10
View File
@@ -24,6 +24,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k
- **Einfacher Modus** (Palette › Einstellungen › Allgemein): blendet Profi-Funktionen (Broadcast, Netzwerk, Team, Agent, Aufzeichnung, MCP, Audit …) aus Palette-Übersicht, Einstellungen und Tastenzeile aus; die Suche in der Palette findet weiter alles
- **Schnellverbinden**: `user@host:port` oder `ssh -p 2222 user@host` in die Palette tippen, ohne die Verbindung anzulegen (Agent/Standard-Keys, sonst Passwort)
- **Mehrere Verbindungen auf einmal ändern**: Im Manager markiert die Leertaste eine Verbindung, `*` alle sichtbaren (mit Suche oder `#tag` also alle Treffer). Danach gelten `e` (Sammeländerung: Tags hinzufügen oder entfernen, Benutzer, Schutz, Farbe), `v` (verschieben) und `d` (löschen, mit Rückgängig) für alle markierten; Esc hebt die Auswahl auf.
- **Aufgaben je Verbindung oder Ordner** (`u` im Manager, Alt+A im Terminal): offene Arbeiten mit Fälligkeit („Zertifikat erneuern bis 12.12.“). ⏎ startet eine Aufgabe als Ziel im offenen Tab der Verbindung (Ziel- oder Agent-Modus, wie zuletzt gewählt); danach steht sie „zur Abnahme“ mit der Meldung der KI und dem Befund der Gegenprüfung, `a` hakt sie ab. Ordner-Aufgaben gelten für jede Verbindung darin (⇧N legt eine an). Die Detailspalte im Manager zeigt offene und fällige Aufgaben, beim Start erinnert eine Meldung an fällige. Gehen mit dem Sync, nie in ein Team-Paket.
- **Notiz je Verbindung**: ein freies Feld nur für dich (Ansprechpartner, Wartungsfenster, Standort). Steht im Manager rechts, die Suche findet es, an die KI geht es nie. Die „KI-Notizen“ bleiben das Feld für Hinweise an die KI.
- **Startbefehl je Verbindung** (Formular › Erweitert): wird nach dem Anmelden einmal sichtbar eingetippt, z. B. `cd /srv/app` oder `sudo -i`. Gefährliche Befehle lehnt das Formular ab; aus einem Team-Paket wird ein Startbefehl nie übernommen.
- **Wake-on-LAN**: Ein ausgeschalteter Rechner im eigenen Netz lässt sich aus dem Manager wecken (Klick auf „Wake-on-LAN senden“, Palette „aufwecken“ oder `w` im getrennten Tab). Die MAC-Adresse merkt sich sshTermy beim ersten Verbinden von selbst oder du trägst sie unter Erweitert ein.
@@ -32,6 +33,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k
- **Wer auf dich wartet**: Ein Tab, der auf ein Passwort, eine `[j/N]`-Frage, eine Taste oder im Pager (`--More--`) wartet, bekommt ein `?` in der Tab-Leiste; Alt+G springt zum nächsten Tab, der wartet oder sich gemeldet hat. **KI-Coding-Agenten** im Tab (Claude Code, Codex, Gemini CLI, OpenCode, Copilot CLI, Cursor Agent, Qwen Code) werden erkannt: Der Tab zeigt, ob der Agent arbeitet, auf deine Freigabe wartet (`◆`, dazu eine Desktop-Meldung) oder fertig ist. Die Tab-Liste (Alt+T) zeigt den Zustand als Text.
- **Klick auf die Desktop-Meldung** (Linux; unter Windows und macOS, wenn du sshTermy nach vorn holst) springt direkt in den Tab, um den es ging.
- **Tabs vom letzten Mal**: Beim Start bietet sshTermy an, die Tabs (mit geteilter Ansicht) der letzten Sitzung wieder zu öffnen; Befehlspalette › „Tabs vom letzten Mal“ stellt auf immer oder nie.
- **Ausgabe vom letzten Mal und „Zuletzt geschlossen“**: Öffnet sshTermy einen Tab wieder (nach dem Neustart oder aus der Liste der zuletzt geschlossenen Tabs: Rechtsklick auf einen Tab oder Palette *Zuletzt geschlossene Tabs*), steht über der neuen Sitzung gedämpft, was zuletzt darin lief, bis 200 Zeilen mit einer Trennlinie. Die Zeilen kommen aus dem verschlüsselten Sitzungsprotokoll; ist es aus, bleibt der Tab leer.
- **Hintergrunddienst** (Befehlspalette › „Hintergrunddienst“, wenn sshTermy in einem Terminal läuft): Sitzungen laufen weiter, wenn du das Terminalfenster schließt; `sshtermy` erneut starten hängt sich wieder an. Strg+Q bietet dann neben Beenden `a` = abkoppeln (Fenster zu, Sitzungen laufen weiter).
- **Zwischenablage-Verlauf** (Alt+Y): die letzten neun Dinge, die du in sshTermy kopiert hast (Markierung, Panel-Text, Befehle, Pfade, OSC 52 vom Server), als Liste; ⏎ oder die Ziffer fügt am Prompt ein (mit Einfügeschutz). Nur im Speicher, bis sshTermy endet; Zeilen, die nach Passwort, Token oder Schlüssel aussehen, kommen nie hinein.
- **Im Web suchen**: Rechtsklick auf eine Markierung zeigt ein kleines Menü: *Kopieren* (wie bisher, ⏎), *Im Web suchen* (z. B. eine Fehlermeldung), *Einfügen*. Gesendet wird nur der markierte Text ohne Passwörter, höchstens 300 Zeichen; die Suchmaschine (DuckDuckGo, Google, Bing, Startpage, Ecosia) stellst du in der Palette ein („Suchmaschine“).
@@ -43,6 +45,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k
- **Neuer Tab über den Manager**: `+` in der Tab-Leiste, Alt+N oder ein Klick aufs Logo `>_ sshTermy` öffnet den Verbindungs-Manager mit Ordnern, Suche und Tags; die gewählte Verbindung (⏎ oder Doppelklick) öffnet sich in einem zusätzlichen Tab, die bisherigen Tabs bleiben offen. Esc führt ohne neuen Tab zurück.
- **Tabs mit der Maus ziehen**: Ein Tab lässt sich in der Tab-Leiste an eine andere Stelle ziehen.
- **Fertig im Hintergrund**: Ein Befehl, der 10 s oder länger in einem verdeckten Tab lief, markiert den Tab (✓ / ×) und meldet sich mit einer Einblendung; ist das sshTermy-Fenster im Hintergrund, kommt zusätzlich eine Desktop-Benachrichtigung (Windows, macOS, Linux). Die Terminal-Glocke markiert den Tab ebenso. Beides ist in der Palette abschaltbar
- **Handy-Meldungen** (Palette *Handy-Meldungen*: ntfy, Gotify oder Webhook): Was als Desktop-Meldung kommt (langer Befehl fertig, Zeitplan gelaufen, Logwache, Farbregel mit `!`, Programm oder KI-Agent wartet auf dich, Gegenprüfung mit Zweifel), geht zusätzlich aufs Handy, wenn du nicht am Rechner bist: Fenster im Hintergrund, gesperrt oder 5 Minuten keine Taste. Der Text läuft durch den Geheimnisfilter, gesperrt steht kein Befehl darin; Fehler und Wartendes kommen mit hoher Priorität. Nach dem Einrichten kommt eine Probemeldung. Gilt je Rechner, geht nicht mit dem Sync.
- **Agent-Weiterleitung** pro Verbindung (wie `ssh -A`): `git pull`, `ssh` und `scp` auf dem Server nutzen deine lokalen Keys aus ssh-agent, Pageant oder dem Windows-OpenSSH-Agent, die Keys verlassen deinen Rechner nie
- **X11-Weiterleitung** pro Verbindung (wie `ssh -X`): Grafische Programme vom Server öffnen sich hier; braucht lokal einen X-Server (XQuartz, VcXsrv, WSLg), das X-Cookie verlässt deinen Rechner nie
- **FIDO2-Sicherheitsschlüssel** (`id_ed25519_sk`, `id_ecdsa_sk`, z. B. YubiKey) werden direkt genutzt; sshTermy sagt dir, wann du den Schlüssel berühren musst (braucht OpenSSH ssh-agent/ssh-add)
@@ -56,6 +59,7 @@ sshTermy ist eine schlanke Terminal-Anwendung (TUI, eine einzige Datei, ~9 MB, k
- **Bilder im Terminal**: Sixel (`img2sixel`, `chafa -f sixel`, gnuplot), das kitty-Grafikprotokoll (`kitty +kitten icat`, `viu`, `timg`) und iTerm2-Bilder (`imgcat`) erscheinen als farbige Halbblöcke direkt im Text, in jedem Terminal mit 24-Bit-Farbe, im Verlauf und in der geteilten Ansicht. Zwei Pixel pro Zelle: Diagramme und Fotos sind erkennbar, nicht pixelgenau. In kitty, Ghostty und im eigenen Fenster von sshTermy erscheinen die Bilder stattdessen pixelgenau (kitty-Grafik mit Unicode-Platzhaltern, sie wandern also weiter mit dem Text; aus mit `SSHTERMY_NO_PIXELS=1`)
- **Zwischenablage vom Server (OSC 52)**: Was du in tmux oder vim auf dem Server kopierst, landet in deiner lokalen Zwischenablage. Lesen kann der Server sie nie
- **Geteilte Ansicht** (Strg+T): bis zu sechs Sitzungen gleichzeitig in sieben Aufteilungen, Größe per Maus oder Alt+⇧+Pfeil, Zoom auf einen Bereich (Alt+Z), Bereiche per Titel tauschen, andere Bereiche auf Wunsch abdunkeln. Die Aufteilung übersteht Updates; **Arbeitsplätze** (w im Manager) speichern Aufteilung und Verbindungen zum Wiederöffnen mit einem Klick, „Zuletzt“ merkt sich sshTermy beim Beenden selbst, `g` auf einem Ordner öffnet alle Verbindungen darin als Raster
- **Panel links, rechts oder unten**: Das Seitenpanel (Ziel, KI fragen, Begleiter, Tunnel, F6) steht rechts, links oder unten (Palette *Seitenpanel andocken*); den Rand zum Terminal ziehst du mit der Maus breiter oder höher, sshTermy merkt sich die Größe. In breiten Fenstern stehen **F5 und der Log-Blick neben dem Terminal** statt darüber (Palette *F5 und Log-Blick neben dem Terminal*): Klick ins Terminal tippt dort weiter, F5 holt die Dateien wieder nach vorn. In der geteilten Ansicht zeigt die **Titelzeile jedes Bereichs** Ordner, letzten Befehl mit Ergebnis und Dauer (✓ 2 s, × 1) und die Last, wenn F6 sie kennt.
- **Eingabe an alle geteilten Bereiche** (Alt+I in der geteilten Ansicht): Was du tippst, geht live an jeden sichtbaren Host, z. B. dieselbe Änderung auf vier Switches. Enter geht nur durch, wenn die Zeile auf keinem Host gefährlich ist
- **SSH-Zertifikate**: Von einer Firmen-CA signierte Keys (`id_ed25519-cert.pub` neben dem Key oder ein eigener Pfad in der Verbindung) werden automatisch genutzt; ein abgelaufenes Zertifikat meldet sshTermy mit Datum
- **Dateien direkt im Terminal (trzsz)**: `tsz datei` auf dem Server lädt in deinen Downloads-Ordner (sshTermy fragt vorher und überschreibt nie eine vorhandene Datei), `trz` lädt hoch; klappt auch nach `sudo su`, über mehrere Sprünge und auf Geräten ohne SFTP. ZMODEM (`sz`/`rz`) wird erkannt und mit Hinweis abgebrochen, statt zu hängen
@@ -108,6 +112,7 @@ nicht als Beweis. Die Liste: Palette *Logwache: Meldungen* oder `w` im Log-Blick
Gefährliches und Runbooks mit Variablen lassen sich gar nicht einplanen. Das Ergebnis je Host steht in der Liste
(⏎), dazu eine Einblendung bzw. Desktop-Meldung. Zeitpläne gehen mit dem Sync, laufen aber nur auf einem Rechner
(„Läuft auf“ im Formular, Standard: der Rechner, der ihn angelegt hat), damit nicht zwei Rechner denselben Lauf starten
- **KI-Prüfung als Zeitplan** (Art *KI-Prüfung (nur lesend)*): ein Prüfauftrag in eigenen Worten, z. B. „läuft nginx, ist eine Platte über 90 %, gibt es neue Fehler im Journal?“, für alle Linux-/Unix-Server eines Ordners. Die KI wählt einmal bis zu fünf Befehle, die nur lesen (was nicht sicher nur liest, fällt weg), sie laufen auf jedem Server, dann urteilt die KI je Host: in Ordnung oder Befund. Das Ergebnis mit den Befehlen steht im Zeitplan, Befunde kommen als Meldung (und aufs Handy, wenn eingerichtet).
- **Runbooks mit Variablen:** `{{vlan}}` oder `{{vlan=20}}` in einem Schritt wird vor dem Start abgefragt, `{{host}}`,
`{{alias}}`, `{{user}}`, `{{port}}` setzt sshTermy pro Host ein. Im Broadcast lädt `e` ein Runbook zum Bearbeiten,
`Strg+R` speichert, `Strg+D` löscht. Vor dem Start prüft die KI mit `k` gegen das Systemprofil jedes Hosts, ob die
@@ -150,6 +155,8 @@ nicht als Beweis. Die Liste: Palette *Logwache: Meldungen* oder `w` im Log-Blick
↑↓ im Zielfeld, ⏎ startet es erneut, Strg+D entfernt es. Der Tab zeigt den Zustand des Ziels (◎ läuft, gelb = wartet auf
dich, grün = erreicht) und die Zahl der Schritte; wartet ein Ziel in einem verdeckten Tab auf dich, kommt eine Einblendung,
ist sshTermy im Hintergrund, eine Desktop-Benachrichtigung.
- **Änderungen ansehen** (`d` nach Ziel oder Agent): Jede Datei, die ein Schritt geändert hat, als Diff (vorher → jetzt) mit +/− je Datei, neu angelegte und gelöschte markiert; nur mit sudo lesbare Dateien liest sshTermy mit `sudo -n cat`. `u` holt danach alles zurück.
- **Gegenprüfung** (Standard an): Meldet die KI „Ziel erreicht“, prüft eine zweite, unabhängige KI-Anfrage nach (ein Ersatz-Anbieter, wenn eingerichtet, sonst dasselbe Modell mit frischem Blick). Sie darf bis zu drei rein lesende Prüfbefehle vorschlagen, die sshTermy unsichtbar in einem eigenen SSH-Kanal ausführt (was nicht sicher nur liest, fällt weg), und urteilt dann: *bestätigt* oder *Zweifel* mit Befund, unter „Ziel erreicht“; Zweifel kommen auch als Meldung. `g` prüft von Hand (noch einmal); abschalten in der Palette („Gegenprüfung“).
- **Agent-Modus** (F2, Tab wählt den Modus): Der Agent arbeitet selbstständig bis zum Ziel. Er führt Befehle aus,
sieht Ausgabe und Exit-Code, legt Skripte per SFTP in `~/.sshtermy-agent/<lauf>/` an und führt sie aus (erst Probelauf).
Stufen: *Vorsichtig* (Standard; nur Lesendes läuft allein), *Normal* (alles außer Gefahr, sudo und Code in der Zeile wie `python -c`, `bash -c`, `eval`; als root angemeldet oder unter Windows fragt jede Änderung, weil es dort kein sudo zum Anhalten gibt), *Voll* (auch sudo).
@@ -363,6 +370,7 @@ sshtermy doctor # Selbstprüfung: Datenordner, Tresor, Schlüsselbund,
| | c / q | SSH-Schlüssel erzeugen oder übertragen / Schnellbefehle bearbeiten |
| | m / f / z | Broadcast an mehrere Hosts / Netzwerk-Scan / Zeitpläne (Strg+N neu, Strg+E bearbeiten, Strg+R jetzt, Strg+O an/aus, ⏎ letztes Ergebnis) |
| | w / g | Arbeitsplätze (gespeicherte Aufteilungen) / Ordner als Raster öffnen |
| | u | Aufgaben der Verbindung bzw. des Ordners: ⏎ als Ziel starten, n neu (⇧N für den Ordner), a abhaken, e ändern, Entf löschen |
| Ordner | o / r / v / d | Ordner anlegen („A / B“ verschachtelt) / bearbeiten (Name, KI-Hausregeln) / verschieben / auflösen (Inhalt bleibt) |
| | ← → Space / - + | Ordner zu-/aufklappen / alle zu bzw. auf |
| | Shift+↑↓ (Alt+↑↓), Maus ziehen | Reihenfolge ändern, in einen Ordner ziehen |
@@ -381,6 +389,7 @@ sshtermy doctor # Selbstprüfung: Datenordner, Tresor, Schlüsselbund,
| | Alt+G | zum nächsten Tab, der wartet (`?`, Passwort, `[j/N]`, Pager) oder sich gemeldet hat (`◆` KI-Agent wartet auf Freigabe, ✓/×) |
| | Alt+C | per Tastatur markieren: Pfeile/hjkl, w/b/e, v markieren, V Zeilen, y kopieren, Esc beenden |
| | Alt+Y | Zwischenablage-Verlauf: zuletzt Kopiertes, ⏎/Ziffer fügt ein |
| | Alt+A | Aufgaben dieser Verbindung |
| | Alt+X | Bildschirm und Verlauf leeren, die Eingabezeile bleibt |
| | Alt+Bild↑ / Alt+Bild↓ / Alt+O | zum vorigen / nächsten Befehl springen / Befehle des Tabs als Liste (⏎ hinspringen, Strg+C Ausgabe kopieren, Strg+K KI fragen, Strg+L lesen) |
| | Alt+N / Alt+W | neuer Tab / Tab schließen (auch `+` und `×` in der Tab-Leiste; `+`, Alt+N und ein Klick aufs Logo `>_ sshTermy` öffnen den Verbindungs-Manager: ⏎ oder Doppelklick startet die Verbindung in einem zusätzlichen Tab, die offenen Tabs bleiben, Esc führt zurück; Rechtsklick auf einen Tab öffnet sein Menü mit *Verbindung bearbeiten …* (Farbe, Notiz) und *Daneben zeigen (geteilt)*, Maus darauf zeigt Ziel, Dauer und Latenz) |
@@ -418,6 +427,7 @@ sshtermy doctor # Selbstprüfung: Datenordner, Tresor, Schlüsselbund,
| | ? / ⇧S | KI anweisen (gilt ab dem nächsten Schritt) / überspringen mit Grund |
| | j / n / q / Leertaste / Strg+C | der laufende Befehl fragt nach: mit den Knöpfen antworten (Esc: selbst im Terminal) |
| | f / u | nach dem Ziel: Folgeziel / vom Ziel geänderte Dateien zurückholen (Strg+R im leeren Zielfeld) |
| | d / g | nach dem Ziel: Änderungen als Diff ansehen / Gegenprüfung (noch einmal) |
| | ⏎ nach Abbruch | Ziel fortsetzen, sobald die Verbindung wieder steht |
| Ziel-Modus, Datei-Schritt | ⏎ / v / s | Datei auf dem Host anlegen / ansehen / überspringen; am Ende löscht `r` den Arbeitsordner |
| | ⏎ / i / e / s / r / x | ausführen / nur einfügen (Dry-Run) / bearbeiten / überspringen / neu / beenden |
+10
View File
@@ -24,6 +24,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer
- **Simple mode** (palette › Settings › General): hides pro features (broadcast, network, team, agent, recording, MCP, audit …) from the palette overview, settings and key bar; searching in the palette still finds everything
- **Quick connect**: type `user@host:port` or `ssh -p 2222 user@host` into the palette without saving the connection (agent/default keys, otherwise password)
- **Change several connections at once**: in the manager Space marks a connection, `*` all visible ones (with a search or `#tag`, all hits). After that `e` (bulk change: add or remove tags, user, protection, color), `v` (move) and `d` (delete, with undo) apply to all marked ones; Esc clears the selection.
- **Tasks per connection or folder** (`u` in the manager, Alt+A in the terminal): open work with a due date (“renew certificate by 12/12”). ⏎ starts a task as a goal in the connection's open tab (goal or agent mode, as last chosen); afterwards it waits “to review” with the AI's message and the cross-check's finding, `a` checks it off. Folder tasks apply to every connection in it (⇧N adds one). The manager's detail column shows open and due tasks, and a notice at start reminds you of due ones. They travel with the sync, never into a team package.
- **Note per connection**: a free field just for you (contact person, maintenance window, location). It shows in the manager on the right, the search finds it, and it is never sent to the AI. “AI notes” remain the field for hints to the AI.
- **Start command per connection** (form › Advanced): typed visibly once after login, e.g. `cd /srv/app` or `sudo -i`. The form rejects dangerous commands; a start command is never taken over from a team package.
- **Wake-on-LAN**: a powered-off machine in your own network can be woken from the manager (click “Send Wake-on-LAN”, palette “wake”, or `w` in a disconnected tab). sshTermy remembers the MAC address on the first connect, or you enter it under Advanced.
@@ -32,6 +33,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer
- **Who is waiting for you**: a tab that waits for a password, a `[y/N]` question, a key or a pager (`--More--`) gets a `?` in the tab bar; Alt+G jumps to the next tab that waits or has a notice. **AI coding agents** in a tab (Claude Code, Codex, Gemini CLI, OpenCode, Copilot CLI, Cursor Agent, Qwen Code) are recognized: the tab shows whether the agent is working, waiting for your approval (`◆`, plus a desktop notification) or done. The tab list (Alt+T) shows the state as text.
- **Click on a desktop notification** (Linux; on Windows and macOS by bringing sshTermy to the front) jumps straight into the tab it was about.
- **Tabs from last time**: when you start sshTermy, it offers to reopen the tabs (with split view) of the last session; palette › “Tabs from last time” sets it to always or never.
- **Output from last time and “Recently closed”**: when sshTermy reopens a tab (after a restart or from the list of recently closed tabs: right-click a tab or palette *Recently closed tabs*), what last ran in it appears dimmed above the new session, up to 200 lines with a separator. The lines come from the encrypted session log; with the log off the tab stays empty.
- **Background service** (palette › “Background service”, when sshTermy runs in a terminal): sessions keep running when you close the terminal window; start `sshtermy` again to attach. Ctrl+Q then offers `a` = detach (window closes, sessions keep running) next to quitting.
- **Clipboard history** (Alt+Y): the last nine things you copied in sshTermy (selection, panel text, commands, paths, OSC 52 from the server) as a list; ⏎ or the digit pastes at the prompt (with paste protection). Kept in memory only until sshTermy quits; lines that look like a password, token or key never go in.
- **Search the web**: right-click a selection for a small menu: *Copy* (as before, ⏎), *Search the web* (e.g. an error message), *Paste*. Only the selected text is sent, without passwords, at most 300 characters; pick the search engine (DuckDuckGo, Google, Bing, Startpage, Ecosia) in the palette (“search engine”).
@@ -43,6 +45,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer
- **New tab via the manager**: `+` in the tab bar, Alt+N or a click on the `>_ sshTermy` logo opens the connection manager with folders, search and tags; the connection you pick (⏎ or double-click) opens in an additional tab, the current tabs stay open. Esc goes back without a new tab.
- **Drag tabs with the mouse**: a tab can be dragged to another position in the tab bar.
- **Finished in the background**: a command that ran 10 s or longer in a hidden tab marks the tab (✓ / ×) and shows a toast; if the sshTermy window is in the background you also get a desktop notification (Windows, macOS, Linux). The terminal bell marks the tab too. Both can be switched off in the palette
- **Phone notifications** (palette *Phone notifications*: ntfy, Gotify or webhook): whatever comes as a desktop notification (long command done, schedule ran, log watch, color rule with `!`, a program or AI agent waiting for you, cross-check with doubt) also goes to your phone when you are away: window in the background, locked or no key for 5 minutes. The text passes the secret filter, when locked no command is in it; failures and waiting come with high priority. A test notification follows the setup. Per computer, not synced.
- **Agent forwarding** per connection (like `ssh -A`): `git pull`, `ssh` and `scp` on the server use your local keys from ssh-agent, Pageant or the Windows OpenSSH agent, the keys never leave your computer
- **X11 forwarding** per connection (like `ssh -X`): graphical programs from the server open here; needs a local X server (XQuartz, VcXsrv, WSLg), the X cookie never leaves your computer
- **FIDO2 security keys** (`id_ed25519_sk`, `id_ecdsa_sk`, e.g. YubiKey) are used directly; sshTermy asks you to touch the key (needs OpenSSH ssh-agent/ssh-add)
@@ -56,6 +59,7 @@ sshTermy is a lean terminal application (TUI, a single file, ~9 MB, no installer
- **Images in the terminal**: Sixel (`img2sixel`, `chafa -f sixel`, gnuplot), the kitty graphics protocol (`kitty +kitten icat`, `viu`, `timg`) and iTerm2 inline images (`imgcat`) show up as colored half blocks right in the text, in every terminal with 24-bit color, in the scrollback and in split view. Two pixels per cell, so plots and photos are recognizable, not pixel-perfect. In kitty, Ghostty and sshTermy's own window the images show pixel-perfect instead (kitty graphics with Unicode placeholders, so they still scroll with the text; off with `SSHTERMY_NO_PIXELS=1`)
- **Clipboard from the server (OSC 52)**: what you copy in tmux or vim on the server lands in your local clipboard. The server can never read it
- **Split view** (Ctrl+T): up to six sessions at once in seven layouts, resize with the mouse or Alt+⇧+arrow, zoom one pane (Alt+Z), swap panes by dragging their title, optionally dim the other panes. The layout survives updates; **workspaces** (w in the manager) save layout and connections to reopen in one go, “Last used” is remembered on quit, `g` on a folder opens all its connections as a grid
- **Panel left, right or bottom**: the side panel (goal, ask AI, companion, tunnels, F6) sits on the right, left or bottom (palette *Dock the side panel*); drag its edge with the mouse to make it wider or taller, sshTermy remembers the size. In wide windows **F5 and the log view sit beside the terminal** instead of over it (palette *F5 and log view beside the terminal*): click into the terminal to keep typing there, F5 brings the files back to the front. In split view the **title line of every pane** shows the folder, the last command with result and duration (✓ 2 s, × 1) and the load if F6 knows it.
- **Type into all split panes** (Alt+I in split view): what you type goes live to every visible host, e.g. the same change on four switches. Enter only goes through if the line is harmless on every host
- **SSH certificates**: keys signed by a company CA (`id_ed25519-cert.pub` next to the key, or any path in the connection) are used automatically; an expired certificate is reported with its date
- **Files right in the terminal (trzsz)**: run `tsz file` on the server to download into your Downloads folder (sshTermy asks first and never overwrites an existing file), or `trz` to upload; works through `sudo su`, several hops and devices without SFTP. ZMODEM (`sz`/`rz`) is detected and cancelled with a hint instead of hanging
@@ -107,6 +111,7 @@ lets them in. The AI status report treats syslog lines as hints, not as proof. T
dangerous steps and runbooks with variables cannot be scheduled at all. The result per host is in the list
(⏎), plus a toast or desktop notification. Schedules travel with the sync but run only on one computer
(“Runs on” in the form, default: the computer that created it), so two computers never start the same run
- **AI check as a schedule** (kind *AI check (read-only)*): a check task in your own words, e.g. “is nginx running, is a disk above 90 %, are there new errors in the journal?”, for all Linux/Unix servers of a folder. The AI picks up to five commands once that only read (anything not surely read-only is dropped), they run on every server, then the AI judges per host: fine or finding. The result with the commands is in the schedule, findings come as a notification (and to the phone, if set up).
- **Runbooks with variables:** `{{vlan}}` or `{{vlan=20}}` in a step is asked before the run, `{{host}}`, `{{alias}}`,
`{{user}}`, `{{port}}` are filled in per host. In the broadcast `e` loads a runbook for editing, `Ctrl+R` saves,
`Ctrl+D` deletes. Before the run `k` lets the AI check the steps against each host's system profile and suggest
@@ -148,6 +153,8 @@ lets them in. The AI status report treats syslog lines as hints, not as proof. T
again, Ctrl+D removes it. The tab shows the goal's state (◎ running, yellow = waiting for you, green = reached) and the
number of steps; if a goal is waiting for you in a hidden tab, a notification pops up, with sshTermy in the background a
desktop notification.
- **See the changes** (`d` after a goal or agent run): every file a step changed as a diff (before → now) with +/− per file, new and deleted files marked; files readable only with sudo are read with `sudo -n cat`. `u` then restores everything.
- **Cross-check** (on by default): when the AI reports “goal reached”, a second, independent AI request checks (a fallback provider if set up, otherwise the same model with a fresh look). It may suggest up to three read-only check commands that sshTermy runs invisibly in a separate SSH channel (anything not surely read-only is dropped), then judges: *confirmed* or *doubts* with a finding, below “Goal reached”; doubts also come as a notice. `g` checks by hand (again); turn it off in the palette (“cross-check”).
- **Agent mode** (F2, Tab picks the mode): the agent works on its own until the goal is reached. It runs commands,
sees their output and exit code, writes scripts via SFTP to `~/.sshtermy-agent/<run>/` and runs them (dry run first).
Levels: *Careful* (default; only read-only commands run on their own), *Normal* (everything except danger, sudo and inline code such as `python -c`, `bash -c`, `eval`; signed in as root or on Windows every change asks, because there is no sudo to stop at),
@@ -352,6 +359,7 @@ sshtermy doctor # self-check: data folder, vault, keychain, SSH agent,
| | c / q | create or copy an SSH key / edit quick commands |
| | m / f / z | broadcast to several hosts / network scan / schedules (Ctrl+N new, Ctrl+E edit, Ctrl+R now, Ctrl+O on/off, ⏎ last result) |
| | w / g | workspaces (saved split layouts) / open a folder as a grid |
| | u | tasks of the connection or folder: ⏎ start as goal, n new (⇧N for the folder), a check off, e edit, Del delete |
| Folders | o / r / v / d | create folder (“A / B” nested) / edit (name, AI house rules) / move / dissolve (content stays) |
| | ← → Space / - + | collapse/expand folder / collapse or expand all |
| | Shift+↑↓ (Alt+↑↓), drag with the mouse | change the order, drag into a folder |
@@ -370,6 +378,7 @@ sshtermy doctor # self-check: data folder, vault, keychain, SSH agent,
| | Alt+G | go to the next tab that waits (`?`, password, `[y/N]`, pager) or has a notice (`◆` AI agent waiting for approval, ✓/×) |
| | Alt+C | select by keys: arrows/hjkl, w/b/e, v select, V lines, y copy, Esc end |
| | Alt+Y | clipboard history: recently copied, ⏎/digit pastes |
| | Alt+A | tasks of this connection |
| | Alt+X | clear screen and scrollback, the input line stays |
| | Alt+PgUp / Alt+PgDn / Alt+O | jump to the previous / next command / list of the tab's commands (⏎ jump, Ctrl+C copy output, Ctrl+K ask AI, Ctrl+L read) |
| | Alt+N / Alt+W | new tab / close tab (also `+` and `×` in the tab bar; `+`, Alt+N and a click on the `>_ sshTermy` logo open the connection manager: ⏎ or a double-click starts the connection in an additional tab, the open tabs stay, Esc goes back; right-click a tab for its menu with *Edit connection …* (color, note) and *Show alongside (split)*, hover it for target, duration and latency) |
@@ -407,6 +416,7 @@ sshtermy doctor # self-check: data folder, vault, keychain, SSH agent,
| | ? / ⇧S | instruct the AI (applies from the next step) / skip with a reason |
| | j / n / q / Space / Ctrl+C | the running command asks for input: answer with the buttons (Esc: answer in the terminal) |
| | f / u | after the goal: follow-up goal / restore the files the goal changed (Ctrl+R in the empty goal field) |
| | d / g | after the goal: see the changes as a diff / cross-check (again) |
| | ⏎ after a drop | continue the goal once the connection is back |
| Goal mode, file step | ⏎ / v / s | create the file on the host / view it / skip; at the end `r` deletes the work folder |
| | ⏎ / i / e / s / r / x | run / only insert (dry run) / edit / skip / suggest again / end |
+138
View File
@@ -0,0 +1,138 @@
package agent
// KI-Prüfung nach Zeitplan: Ein Prüfauftrag in eigenen Worten („Läuft
// nginx, ist die Platte unter 90 %, gibt es neue Fehler im Journal?“) läuft
// ohne Aufsicht über alle Server eines Ordners. Die KI schlägt dafür einmal
// bis zu fünf Befehle vor, die nur lesen (was nicht sicher nur liest, fällt
// weg), sie laufen auf jedem Host, und die KI urteilt danach je Host:
// in Ordnung oder Befund.
import (
"context"
"fmt"
"strings"
"github.com/db9979/sshtermy/internal/llm"
"github.com/db9979/sshtermy/internal/safety"
)
// TaskSchedCheck: KI-Prüfung nach Zeitplan (KI-Status, Verbrauch).
const TaskSchedCheck = "sched-check"
// MaxSchedChecks: so viele Prüfbefehle höchstens.
const MaxSchedChecks = 5
const sysSchedChecks = "Du prüfst regelmäßig und ohne Aufsicht mehrere Server. Du bekommst einen Prüfauftrag in eigenen Worten. " +
"Schlag bis zu 5 kurze Befehle vor, die auf jedem der Server laufen und NUR LESEN (Status, Füllstand, Logs der letzten Zeit, " +
"Versionen). Nichts, was etwas ändert, neu startet, installiert, löscht oder schreibt, und nichts Interaktives (kein less, top, " +
"watch, tail -f). Antworte nur mit JSON " + `{"befehle": ["befehl", …]}.` + guard
const sysSchedJudge = "Du prüfst regelmäßig und ohne Aufsicht mehrere Server. Beurteile anhand des Prüfauftrags und der Ausgaben " +
"je Host, ob alles in Ordnung ist. Sei sachlich: nur melden, was die Ausgaben belegen. Antworte nur mit JSON " +
`{"hosts": [{"host": "name", "ok": true|false, "befund": "ein kurzer Satz"}], "zusammenfassung": "ein Satz für alle"}.` + guard
// HostOutput: Ausgaben der Prüfbefehle auf einem Host.
type HostOutput struct {
Host string
Results []CheckResult
Err string // Host nicht erreicht
}
// HostVerdict: Urteil je Host.
type HostVerdict struct {
Host string
OK bool
Finding string
}
// SchedChecks: rein lesende Befehle für den Prüfauftrag.
func (a *Agent) SchedChecks(ctx context.Context, task string, hosts []string, c Context) ([]string, error) {
user := material(c) + "\n\n<<<\nPrüfauftrag: " + oneLineText(task) + "\nServer: " + strings.Join(hosts, ", ") + "\n>>>"
if !c.Raw {
user = Redact(user)
}
out, err := a.C.Complete(ctx, []llm.Message{
{Role: "system", Content: a.sys(sysSchedChecks)},
{Role: "user", Content: user},
}, llm.Opts{MaxTokens: 400, Temperature: 0.1, NoThink: true, JSON: true, Task: TaskSchedCheck})
if err != nil {
return nil, err
}
var v struct {
B []string `json:"befehle"`
}
if !strictJSON(out, &v) {
return nil, ErrUnreadable
}
kind := c.kind()
var cmds []string
for _, x := range v.B {
line, ok := oneLine(x, maxCmd)
if !ok || line == "" || !safety.ReadOnly(line, kind) {
continue
}
cmds = append(cmds, line)
if len(cmds) == MaxSchedChecks {
break
}
}
return cmds, nil
}
// SchedJudge: Urteil je Host und eine Zusammenfassung.
func (a *Agent) SchedJudge(ctx context.Context, task string, outs []HostOutput, c Context) ([]HostVerdict, string, error) {
n := 0
for _, o := range outs {
n += max(1, len(o.Results))
}
per := max(200, 24000/max(1, n)) // alles zusammen bleibt überschaubar
var b strings.Builder
fmt.Fprintf(&b, "%s\n\n<<<\nPrüfauftrag: %s\n", Today(c.Now), oneLineText(task))
for _, o := range outs {
fmt.Fprintf(&b, "\n## %s\n", o.Host)
if o.Err != "" {
fmt.Fprintf(&b, "nicht erreicht: %s\n", oneLineText(o.Err))
continue
}
for _, x := range o.Results {
fmt.Fprintf(&b, "$ %s (Exit %d)\n%s\n", x.Command, x.Exit, indent(tailRunes(strings.TrimSpace(x.Output), per)))
}
}
b.WriteString(">>>")
user := b.String()
if !c.Raw {
user = Redact(user)
}
out, err := a.C.Complete(ctx, []llm.Message{
{Role: "system", Content: a.sys(sysSchedJudge)},
{Role: "user", Content: user},
}, llm.Opts{MaxTokens: 300 + 60*len(outs), Temperature: 0.1, NoThink: true, JSON: true, Task: TaskSchedCheck})
if err != nil {
return nil, "", err
}
var v struct {
Hosts []struct {
Host string `json:"host"`
OK *bool `json:"ok"`
F string `json:"befund"`
} `json:"hosts"`
Sum string `json:"zusammenfassung"`
}
if !strictJSON(out, &v) {
return nil, "", ErrUnreadable
}
known := map[string]bool{}
for _, o := range outs {
known[o.Host] = true
}
var vs []HostVerdict
for _, h := range v.Hosts {
if h.OK == nil || !known[h.Host] {
continue // nur Hosts, die es gibt
}
f, _ := oneLine(Clean(h.F), 300)
vs = append(vs, HostVerdict{Host: h.Host, OK: *h.OK, Finding: f})
}
sum, _ := oneLine(Clean(v.Sum), 300)
return vs, sum, nil
}
+37
View File
@@ -0,0 +1,37 @@
package agent
import (
"context"
"strings"
"testing"
)
func TestSchedChecks(t *testing.T) {
ag, seen := fakeSeen(t, `{"befehle": ["systemctl is-active nginx", "systemctl restart nginx", "df -h /", "rm -rf /tmp/x", "journalctl -p err --since -1d --no-pager | tail -20", "uptime", "free -m", "ss -ltn"]}`)
cmds, err := ag.SchedChecks(context.Background(), "läuft nginx? password=geheim", []string{"web1", "web2"}, Context{Host: "web", OS: "Debian 12"})
if err != nil {
t.Fatal(err)
}
if len(cmds) == 0 || len(cmds) > MaxSchedChecks {
t.Fatalf("%v", cmds)
}
for _, c := range cmds {
if strings.Contains(c, "restart") || strings.Contains(c, "rm ") {
t.Errorf("ändernd: %q", c)
}
}
if all := strings.Join(*seen, "\n"); strings.Contains(all, "geheim") || !strings.Contains(all, "web2") {
t.Errorf("Material:\n%s", all)
}
}
func TestSchedJudge(t *testing.T) {
ag, _ := fakeSeen(t, `{"hosts": [{"host": "web1", "ok": true, "befund": "alles gut"}, {"host": "web2", "ok": false, "befund": "Platte 97 % voll"}, {"host": "erfunden", "ok": false, "befund": "x"}], "zusammenfassung": "web2 braucht Platz"}`)
vs, sum, err := ag.SchedJudge(context.Background(), "Platte", []HostOutput{
{Host: "web1", Results: []CheckResult{{Command: "df -h /", Output: "40%"}}},
{Host: "web2", Results: []CheckResult{{Command: "df -h /", Output: "97%"}}},
}, Context{})
if err != nil || len(vs) != 2 || vs[1].OK || !strings.Contains(sum, "web2") {
t.Fatalf("%+v %q %v", vs, sum, err)
}
}
+158
View File
@@ -0,0 +1,158 @@
package agent
// Gegenprüfung: Nach einem Ziel oder Agent-Lauf prüft eine zweite,
// unabhängige KI-Anfrage (wenn eingerichtet ein anderer Anbieter), ob das
// Ziel wirklich erreicht ist. Sie sieht das Ziel, die Schritte mit Ausgaben
// und darf bis zu drei rein lesende Prüfbefehle vorschlagen; was nicht
// sicher nur liest (safety.ReadOnly), fällt weg. Danach urteilt sie mit den
// Ausgaben: bestätigt oder Zweifel, mit kurzem Befund.
import (
"context"
"fmt"
"strings"
"github.com/db9979/sshtermy/internal/llm"
"github.com/db9979/sshtermy/internal/safety"
)
// TaskVerify: Gegenprüfung nach einem Ziel (KI-Status).
const TaskVerify = "verify"
// MaxVerifyChecks: so viele Prüfbefehle höchstens.
const MaxVerifyChecks = 3
const sysVerifyChecks = "Du bist eine zweite, unabhängige Prüferin. Ein anderer Assistent hat auf einem Server oder Netzwerkgerät " +
"ein Ziel abgearbeitet und meldet „erreicht“. Glaub das nicht einfach. Schlag bis zu 3 kurze Befehle vor, die NUR LESEN " +
"und zeigen, ob das Ziel wirklich erreicht ist (z. B. Dienststatus, Port offen, Datei enthält die Zeile, Version). " +
"Nichts, was etwas ändert, neu startet, installiert oder schreibt. Antworte nur mit JSON " +
`{"pruefungen": ["befehl", …]} (leere Liste, wenn die Ausgaben schon reichen).` + guard
const sysVerifyJudge = "Du bist eine zweite, unabhängige Prüferin. Beurteile anhand des Ziels, der Schritte und der Ausgaben deiner " +
"Prüfbefehle, ob das Ziel wirklich erreicht ist. Sei streng: fehlt ein Beleg, ist das ein Zweifel. Antworte nur mit JSON " +
`{"erreicht": true|false, "befund": "ein bis zwei kurze Sätze, was belegt ist oder was fehlt"}.` + guard
// Verdict: Ergebnis der Gegenprüfung.
type Verdict struct {
OK bool
Finding string
}
// verifyMaterial: Ziel und Schritte (gekürzt, ohne Geheimnisse).
func verifyMaterial(goal, reason string, steps []DoneStep, c Context) string {
var b strings.Builder
b.WriteString(material(c) + "\n\n")
fmt.Fprintf(&b, "<<<\nZiel: %s\nMeldung des Assistenten: %s\nSchritte:\n", oneLineText(goal), oneLineText(reason))
from := max(0, len(steps)-15)
for i, s := range steps[from:] {
state := ""
switch {
case s.Skipped:
state = " (ausgelassen)"
case s.Exit != nil:
state = fmt.Sprintf(" (Exit %d)", *s.Exit)
case s.ExitHint != "":
state = " (" + s.ExitHint + ")"
}
cmd := s.Command
if s.File != "" {
cmd = "Datei " + s.File + ": " + s.Command
}
fmt.Fprintf(&b, "%d. %s%s\n", from+i+1, cmd, state)
if o := strings.TrimSpace(s.Output); o != "" {
b.WriteString(indent(tailRunes(o, 600)) + "\n")
}
}
b.WriteString(">>>")
out := b.String()
if !c.Raw {
out = Redact(out)
}
return out
}
func oneLineText(s string) string { return strings.Join(strings.Fields(s), " ") }
func tailRunes(s string, n int) string {
r := []rune(s)
if len(r) <= n {
return s
}
return "…" + string(r[len(r)-n:])
}
func indent(s string) string {
return " " + strings.ReplaceAll(s, "\n", "\n ")
}
// VerifyChecks: rein lesende Prüfbefehle (höchstens MaxVerifyChecks).
func (a *Agent) VerifyChecks(ctx context.Context, goal, reason string, steps []DoneStep, c Context) ([]string, error) {
out, err := a.C.Complete(ctx, []llm.Message{
{Role: "system", Content: a.sys(sysVerifyChecks)},
{Role: "user", Content: verifyMaterial(goal, reason, steps, c)},
}, llm.Opts{MaxTokens: 300, Temperature: 0.1, NoThink: true, JSON: true, Task: TaskVerify})
if err != nil {
return nil, err
}
var v struct {
P []string `json:"pruefungen"`
}
if !strictJSON(out, &v) {
return nil, ErrUnreadable
}
kind := c.kind()
var cmds []string
for _, x := range v.P {
line, ok := oneLine(x, maxCmd)
if !ok || line == "" || !safety.ReadOnly(line, kind) {
continue
}
cmds = append(cmds, line)
if len(cmds) == MaxVerifyChecks {
break
}
}
return cmds, nil
}
// CheckResult: Ausgabe eines Prüfbefehls.
type CheckResult struct {
Command string
Output string
Exit int
}
// VerifyJudge: Urteil mit den Ausgaben der Prüfbefehle.
func (a *Agent) VerifyJudge(ctx context.Context, goal, reason string, steps []DoneStep, checks []CheckResult, c Context) (Verdict, error) {
var b strings.Builder
b.WriteString(verifyMaterial(goal, reason, steps, c))
if len(checks) == 0 {
b.WriteString("\n\nKeine eigenen Prüfbefehle gelaufen: urteile nur anhand der Schritte.")
} else {
b.WriteString("\n\nDeine Prüfbefehle:\n<<<\n")
for _, x := range checks {
fmt.Fprintf(&b, "$ %s (Exit %d)\n%s\n", x.Command, x.Exit, indent(tailRunes(strings.TrimSpace(x.Output), 1500)))
}
b.WriteString(">>>")
}
user := b.String()
if !c.Raw {
user = Redact(user)
}
out, err := a.C.Complete(ctx, []llm.Message{
{Role: "system", Content: a.sys(sysVerifyJudge)},
{Role: "user", Content: user},
}, llm.Opts{MaxTokens: 300, Temperature: 0.1, NoThink: true, JSON: true, Task: TaskVerify})
if err != nil {
return Verdict{}, err
}
var v struct {
OK *bool `json:"erreicht"`
F string `json:"befund"`
}
if !strictJSON(out, &v) || v.OK == nil {
return Verdict{}, ErrUnreadable
}
f, _ := oneLine(Clean(v.F), 400)
return Verdict{OK: *v.OK, Finding: f}, nil
}
+42
View File
@@ -0,0 +1,42 @@
package agent
import (
"context"
"strings"
"testing"
)
func TestVerifyChecksOnlyReadOnly(t *testing.T) {
ag, seen := fakeSeen(t, `{"pruefungen": ["systemctl is-active nginx", "systemctl restart nginx", "curl -sI http://localhost", "cat /etc/nginx/nginx.conf", "ss -ltn"]}`)
exit := 0
steps := []DoneStep{{Command: "apt install -y nginx", Exit: &exit, Output: "Setting up nginx\npassword=geheim"}}
cmds, err := ag.VerifyChecks(context.Background(), "nginx installieren", "läuft", steps, Context{Host: "web", OS: "Debian 12"})
if err != nil {
t.Fatal(err)
}
for _, c := range cmds {
if strings.Contains(c, "restart") {
t.Errorf("ändernder Befehl durchgelassen: %q", c)
}
}
if len(cmds) == 0 || len(cmds) > MaxVerifyChecks {
t.Errorf("Prüfbefehle: %v", cmds)
}
all := strings.Join(*seen, "\n")
if strings.Contains(all, "geheim") || !strings.Contains(all, "apt install -y nginx") {
t.Errorf("Material falsch:\n%s", all)
}
}
func TestVerifyJudge(t *testing.T) {
ag, _ := fakeSeen(t, `{"erreicht": false, "befund": "nginx läuft, aber Port 443 ist zu."}`)
v, err := ag.VerifyJudge(context.Background(), "nginx mit TLS", "fertig", nil,
[]CheckResult{{Command: "ss -ltn", Output: "LISTEN 0 511 *:80", Exit: 0}}, Context{Host: "web"})
if err != nil || v.OK || !strings.Contains(v.Finding, "443") {
t.Fatalf("%+v %v", v, err)
}
bad, _ := fakeSeen(t, `ich weiß nicht`)
if _, err := bad.VerifyJudge(context.Background(), "x", "y", nil, nil, Context{}); err != ErrUnreadable {
t.Errorf("unlesbar: %v", err)
}
}
+3 -1
View File
@@ -26,7 +26,9 @@ type Folder struct {
Collapsed bool `json:"collapsed,omitempty"`
// AIRules: Hausregeln für die KI, gelten für alle Verbindungen in diesem
// Ordner und seinen Unterordnern (zusätzlich zu LLMConfig.Rules).
AIRules string `json:"ai_rules,omitempty"`
AIRules string `json:"ai_rules,omitempty"`
// Tasks: Aufgaben für alle Verbindungen in diesem Ordner (tasks.go).
Tasks []Task `json:"tasks,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
+37 -8
View File
@@ -74,6 +74,8 @@ type Connection struct {
// Standort). Nur für Menschen: Sie geht nie an die KI (dafür gibt es die
// KI-Notizen im Systemprofil) und nicht in ein Team-Paket.
Note string `json:"note,omitempty"`
// Tasks: offene Arbeiten an dieser Verbindung (domain/tasks.go).
Tasks []Task `json:"tasks,omitempty"`
// StartCmd: Befehl, den sshTermy nach dem Anmelden einmal sichtbar am
// Prompt eintippt (z. B. „cd /srv/app“). Nicht zusammen mit einer festen
// Sitzung. Gefährliche Befehle lehnt das Formular ab; aus einem
@@ -606,6 +608,19 @@ type Settings struct {
// DimPanes: in der geteilten Ansicht die nicht aktiven Bereiche abdunkeln.
DimPanes bool `json:"dim_panes,omitempty"`
// NoVerify: keine Gegenprüfung nach Ziel/Agent (ui/goalverify.go).
NoVerify bool `json:"no_verify,omitempty"`
// PanelDock: Seitenpanel rechts (""), links ("left") oder unten ("bottom");
// PanelW/PanelH: mit der Maus gezogene Größe, 0 = automatisch (ui/dock.go).
PanelDock string `json:"panel_dock,omitempty"`
PanelW int `json:"panel_w,omitempty"`
PanelH int `json:"panel_h,omitempty"`
// NoPaneStatus: keine Statuszeile (Ordner, letzter Befehl, Last) je Bereich (ui/panestatus.go).
NoPaneStatus bool `json:"no_pane_status,omitempty"`
// FilesBeside: F5 und Log-Blick in breiten Fenstern neben dem Terminal (ui/dock.go).
FilesBeside bool `json:"files_beside,omitempty"`
// Push: Handy-Meldungen über ntfy, Gotify oder Webhook, wenn niemand am Rechner ist.
Push PushConfig `json:"push,omitzero"`
// WebSearch: Suchmaschine für „Im Web suchen“ ("" = DuckDuckGo, ui/websearch.go).
WebSearch string `json:"web_search,omitempty"`
// NoHistGhost: Ghost-Text nicht zuerst aus dem Befehlsverlauf (ui/histghost.go).
@@ -729,16 +744,26 @@ func (s Settings) SyncedPart() Settings {
s.LastLayout, s.Editor, s.Schedules, s.KeysHere = nil, "", nil, nil // Zeitpläne: eigener Abgleich
s.Debug, s.Audit, s.MCP = false, false, ""
s.SyslogPort, s.SyslogAny = 0, false
s.UpdateWaitH = 0 // Update-Kanal gilt je Rechner
s.CmdSetApproved = nil // Freigaben gelten für die Team-Dateien dieses Rechners
s.Share = ShareConfig{} // Teilen: Vorgaben und Weg gelten je Rechner (Vermittler sind lokal)
s.Vuln = VulnConfig{} // Sicherheitscheck: Quelle/Spiegel/Ausnahmen je Rechner
s.Header = HeaderConfig{} // lokaler Befehl in der Kopfzeile: nie per Sync
s.RestoreTabs = "" // Tabs vom letzten Mal: je Rechner
s.WebSearch, s.NoHistGhost = "", false // Suchmaschine, Ghost aus dem Verlauf: je Rechner
s.UpdateWaitH = 0 // Update-Kanal gilt je Rechner
s.CmdSetApproved = nil // Freigaben gelten für die Team-Dateien dieses Rechners
s.Share = ShareConfig{} // Teilen: Vorgaben und Weg gelten je Rechner (Vermittler sind lokal)
s.Vuln = VulnConfig{} // Sicherheitscheck: Quelle/Spiegel/Ausnahmen je Rechner
s.Header = HeaderConfig{} // lokaler Befehl in der Kopfzeile: nie per Sync
s.RestoreTabs = "" // Tabs vom letzten Mal: je Rechner
s.WebSearch, s.NoHistGhost = "", false // Suchmaschine, Ghost aus dem Verlauf: je Rechner
s.NoVerify = false // Gegenprüfung: je Rechner
s.PanelDock, s.PanelW, s.PanelH, s.FilesBeside, s.NoPaneStatus = "", 0, 0, false, false // Panel-Lage passt zum Bildschirm dieses Rechners
s.Push = PushConfig{} // Handy-Meldungen: je Rechner (sonst melden alle Rechner doppelt)
return s
}
// PushConfig: Handy-Meldungen über ntfy, Gotify oder Webhook (push.go). Lokal.
type PushConfig struct {
Kind string `json:"kind,omitempty"` // "" = aus, ntfy, gotify, webhook
URL string `json:"url,omitempty"`
Token Secret `json:"token,omitempty"`
}
// HeaderConfig: eigene Felder rechts in der Kopfzeile.
type HeaderConfig struct {
Clock bool `json:"clock,omitempty"` // Uhrzeit HH:MM
@@ -1106,7 +1131,8 @@ type Schedule struct {
Conns []string `json:"conns,omitempty"`
Kind string `json:"kind,omitempty"` // "" = Befehle/Runbook, "backup" = Switch-Configs sichern, "logs" = Ordner-Scan
RunbookID string `json:"runbook_id,omitempty"`
Steps []string `json:"steps,omitempty"` // ohne Runbook
Steps []string `json:"steps,omitempty"` // ohne Runbook
Prompt string `json:"prompt,omitempty"` // KI-Prüfung: Prüfauftrag in eigenen Worten
Off bool `json:"off,omitempty"`
LastRun time.Time `json:"last_run,omitempty"`
LastOK int `json:"last_ok,omitempty"`
@@ -1136,6 +1162,9 @@ const ScheduleBackup = "backup"
// ScheduleLogs: Zeitplan macht einen Ordner-Scan der Logs (Log-Blick je Host).
const ScheduleLogs = "logs"
// ScheduleAI: Zeitplan lässt die KI rein lesend prüfen (Prompt).
const ScheduleAI = "ai"
// ScheduleVuln: Zeitplan prüft die Pakete aller Server im Ziel gegen OSV.
const ScheduleVuln = "osv"
+98
View File
@@ -0,0 +1,98 @@
package domain
import (
"regexp"
"strconv"
"strings"
"time"
)
// Aufgaben je Verbindung oder Ordner: offene Arbeiten („Zertifikat bis
// 12.12. erneuern“). Eine Aufgabe läuft als Ziel im Ziel- oder Agent-Modus,
// danach steht sie „zur Abnahme“, bis du sie abhakst. Gehen mit dem Sync
// (Teil der Verbindung bzw. des Ordners), nie in ein Team-Paket und nie an
// die KI außer als Ziel, das du selbst startest.
// Zustände einer Aufgabe.
const (
TaskOpen = "" // offen
TaskRunning = "running" // läuft gerade als Ziel
TaskReview = "review" // Ziel erreicht, wartet auf deine Abnahme
TaskDone = "done" // abgehakt
)
// Task: eine Aufgabe.
type Task struct {
ID string `json:"id"`
Text string `json:"text"`
Due time.Time `json:"due,omitempty"` // Fälligkeit (Datum, 0 = keine)
State string `json:"state,omitempty"`
// Note: Ergebnis des Ziels (Meldung der KI, Gegenprüfung).
Note string `json:"note,omitempty"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated,omitempty"`
}
// Overdue: fällig und noch nicht erledigt.
func (t Task) Overdue(now time.Time) bool {
return !t.Due.IsZero() && t.State != TaskDone && !now.Before(t.Due)
}
// OpenTasks: Aufgaben, die noch nicht abgehakt sind.
func OpenTasks(ts []Task) int {
n := 0
for _, t := range ts {
if t.State != TaskDone {
n++
}
}
return n
}
var dueRe = regexp.MustCompile(`(?i)\s*\b(?:bis|by|due|fällig)?\s*(\d{1,2})\.(\d{1,2})\.(\d{2,4})?\s*$|\s*\b(?:bis|by|due|fällig)\s+(\d{4})-(\d{2})-(\d{2})\s*$`)
// ParseTaskText trennt eine Fälligkeit am Ende ab: „… bis 12.12.“,
// „… 12.12.2026“, „… by 2026-12-12“. Ohne Jahr gilt das nächste Vorkommen.
func ParseTaskText(s string, now time.Time) (string, time.Time) {
s = strings.TrimSpace(s)
m := dueRe.FindStringSubmatchIndex(s)
if m == nil {
return s, time.Time{}
}
sub := func(i int) string {
if m[2*i] < 0 {
return ""
}
return s[m[2*i]:m[2*i+1]]
}
var y, mo, d int
if sub(1) != "" {
d, _ = strconv.Atoi(sub(1))
mo, _ = strconv.Atoi(sub(2))
if ys := sub(3); ys != "" {
y, _ = strconv.Atoi(ys)
if y < 100 {
y += 2000
}
}
} else {
y, _ = strconv.Atoi(sub(4))
mo, _ = strconv.Atoi(sub(5))
d, _ = strconv.Atoi(sub(6))
}
if mo < 1 || mo > 12 || d < 1 || d > 31 {
return s, time.Time{}
}
if y == 0 {
y = now.Year()
if time.Date(y, time.Month(mo), d, 0, 0, 0, 0, now.Location()).Before(now.AddDate(0, 0, -1)) {
y++
}
}
due := time.Date(y, time.Month(mo), d, 0, 0, 0, 0, now.Location())
text := strings.TrimSpace(s[:m[0]])
if text == "" {
return s, time.Time{}
}
return text, due
}
+39
View File
@@ -0,0 +1,39 @@
package domain
import (
"testing"
"time"
)
func TestParseTaskText(t *testing.T) {
now := time.Date(2026, 11, 20, 20, 0, 0, 0, time.Local)
cases := []struct {
in, text, due string
}{
{"Zertifikat erneuern bis 12.12.", "Zertifikat erneuern", "2026-12-12"},
{"Backup prüfen 3.1.", "Backup prüfen", "2027-01-03"}, // ohne Jahr: nächstes Vorkommen
{"Kernel-Update 24.12.2026", "Kernel-Update", "2026-12-24"},
{"Patch by 2027-02-01", "Patch", "2027-02-01"},
{"Version 1.2.3 einspielen", "Version 1.2.3 einspielen", ""},
{"bis 12.12.", "bis 12.12.", ""},
{"nginx neu laden", "nginx neu laden", ""},
}
for _, c := range cases {
text, due := ParseTaskText(c.in, now)
got := ""
if !due.IsZero() {
got = due.Format("2006-01-02")
}
if text != c.text || got != c.due {
t.Errorf("%q → %q %q, erwartet %q %q", c.in, text, got, c.text, c.due)
}
}
tk := Task{Due: now.AddDate(0, 0, -1)}
if !tk.Overdue(now) {
t.Error("überfällig")
}
tk.State = TaskDone
if tk.Overdue(now) || OpenTasks([]Task{tk, {}}) != 1 {
t.Error("erledigt zählt nicht")
}
}
+65
View File
@@ -0,0 +1,65 @@
package i18n
// Ideen aus termilly, Paket B: Diff, Gegenprüfung, Aufgaben.
func init() {
for de, e := range map[string]string{
" … %d weitere Zeilen": " … %d more lines",
" · %d fällig": " · %d due",
" · %d zur Abnahme": " · %d to review",
" · u zeigt": " · u shows",
"%s fällig · u im Manager zeigt die Aufgaben": "%s due · u in the manager shows the tasks",
"%s zur Abnahme · u im Manager": "%s to review · u in the manager",
". Fälligkeit am Ende, z. B. „bis 12.12.“": ". Due date at the end, e.g. “by 12/12”",
"Aufgabe": "task",
"Aufgabe gelöscht: ": "Task deleted: ",
"Aufgabe ändern": "Edit task",
"Aufgaben": "Tasks",
"Aufgaben dieser Verbindung": "Tasks of this connection",
"Aufgaben der Verbindung bzw. des Ordners": "Tasks of the connection or folder",
"Die Verbindung liegt in keinem Ordner": "The connection is not in a folder",
"Erst mit %s verbinden, dann ⏎ in den Aufgaben (Alt+A)": "Connect to %s first, then ⏎ in the tasks (Alt+A)",
"Fälligkeit am Ende, z. B. „bis 12.12.“": "Due date at the end, e.g. “by 12/12”",
"Für ": "For ",
"Gegenprüfung an: eine zweite KI prüft jedes erreichte Ziel nur lesend nach": "Cross-check on: a second AI checks every reached goal, read-only",
"Gegenprüfung aus (g im fertigen Ziel prüft trotzdem)": "Cross-check off (g on a finished goal still checks)",
"Gegenprüfung aus · g prüft jetzt": "Cross-check off · g checks now",
"Gegenprüfung hat Zweifel": "Cross-check has doubts",
"Gegenprüfung hat Zweifel: ": "Cross-check has doubts: ",
"Gegenprüfung nach Ziel und Agent (zweite KI, nur lesend)": "Cross-check after goal and agent (second AI, read-only)",
"Gegenprüfung nicht möglich: ": "Cross-check not possible: ",
"Gegenprüfung: ": "Cross-check: ",
"Kein offener Tab zu dieser Aufgabe: erst verbinden": "No open tab for this task: connect first",
"Keine gesicherten Änderungen zum Vergleichen": "No backed-up changes to compare",
"Lese den jetzigen Stand der Dateien …": "Reading the current state of the files …",
"Neue Aufgabe": "New task",
"Noch keine Aufgaben. n legt eine an, z. B. „Zertifikat erneuern bis 12.12.“.": "No tasks yet. n adds one, e.g. “renew certificate by 12/12”.",
"Schon erledigt · a öffnet sie wieder": "Already done · a reopens it",
"Vergleichen braucht eine Verbindung mit SFTP": "Comparing needs a connection with SFTP",
"Vergleichen: ": "Compare: ",
"Ziel abgebrochen": "Goal stopped",
"abhaken": "check off",
"als Ziel starten": "start as goal",
"bis ": "by ",
"dem Ordner ": "the folder ",
"dieser Verbindung": "this connection",
"fällig ": "due ",
"gelöscht": "deleted",
"geprüft: ": "checked: ",
"ist jetzt ein Ordner": "is a folder now",
"neu für den Ordner": "new for the folder",
"u im Panel holt alle Dateien zurück (so wie vor dem Ziel).": "u in the panel restores all files (as before the goal).",
"z. B. Zertifikat erneuern bis 12.12.": "e.g. renew certificate by 12/12",
"zur Abnahme": "to review",
"Änderungen auf %s · %s ": "Changes on %s · %s ",
"▲ Gegenprüfung hat Zweifel": "▲ Cross-check has doubts",
"◌ Gegenprüfung läuft (nur lesend) …": "◌ Cross-check running (read-only) …",
"✓ Gegenprüfung bestätigt": "✓ Cross-check confirmed",
"Änderungen": "changes",
"Änderungen als Diff ansehen": "see the changes as a diff",
"Gegenprüfung (zweite KI, nur lesend)": "cross-check (second AI, read-only)",
"Aufgaben (To-do) der Verbindung / des Ordners": "tasks (to-do) of the connection / folder",
"läuft": "running",
} {
en[de] = e
}
}
+56
View File
@@ -0,0 +1,56 @@
package i18n
// Ideen aus termilly, Paket C: alte Ausgabe, KI-Prüfung im Zeitplan, Handy-Meldungen.
func init() {
for de, e := range map[string]string{
"%d in Ordnung, %d mit Befund": "%d fine, %d with findings",
"Adresse des Gotify-Servers, z. B. https://gotify.example.org": "Address of the Gotify server, e.g. https://gotify.example.org",
"Adresse mit Thema, z. B. https://ntfy.sh/ein-langes-zufälliges-thema (das Thema wirkt wie ein Passwort). In der ntfy-App dasselbe Thema abonnieren.": "Address with topic, e.g. https://ntfy.sh/a-long-random-topic (the topic works like a password). Subscribe to the same topic in the ntfy app.",
"Adresse mit http:// oder https:// angeben": "Give an address with http:// or https://",
"App ntfy, eigener Server oder ntfy.sh": "ntfy app, own server or ntfy.sh",
"App-Token aus Gotify (Apps › Anlegen).": "App token from Gotify (Apps › Create).",
"Art unbekannt": "Unknown kind",
"Ausgabe vom letzten Mal": "Output from last time",
"Die KI hat keinen Befehl vorgeschlagen, der sicher nur liest": "The AI suggested no command that only reads",
"Gotify braucht ein App-Token": "Gotify needs an app token",
"Handy-Meldung ging nicht raus: ": "Phone notification failed: ",
"Handy-Meldungen (ntfy, Gotify, Webhook) …": "Phone notifications (ntfy, Gotify, webhook) …",
"Handy-Meldungen aus": "Phone notifications off",
"Handy-Meldungen sind aus": "Phone notifications are off",
"Handy-Meldungen, wenn du nicht am Rechner bist": "Phone notifications when you are away from the computer",
"Handy-Meldungen: ": "Phone notifications: ",
"Handy-Meldungen: Token": "Phone notifications: token",
"JSON an eine Adresse (Slack, Mattermost, Home Assistant …)": "JSON to an address (Slack, Mattermost, Home Assistant …)",
"KI-Prüfung (nur lesend)": "AI check (read-only)",
"KI-Prüfung": "AI check",
"Kein Linux- oder Unix-Server im Ziel (die KI-Prüfung läuft nicht auf Switches und Windows)": "No Linux or Unix server in the target (the AI check does not run on switches and Windows)",
"Leer lassen behält das gespeicherte Token.": "Leave empty to keep the saved token.",
"Noch kein Tab geschlossen": "No tab closed yet",
"Optional: wird als „Authorization: Bearer …“ mitgeschickt. Leer = ohne.": "Optional: sent as “Authorization: Bearer …”. Empty = none.",
"Probemeldung ans Handy schicken": "Send a test notification to the phone",
"Probemeldung ging nicht raus: ": "Test notification failed: ",
"Probemeldung verschickt, schau aufs Handy": "Test notification sent, check your phone",
"Probemeldung wird geschickt …": "Sending test notification …",
"Prüfauftrag fehlt: in eigenen Worten, was die KI prüfen soll": "Check task missing: in your own words, what the AI should check",
"Prüfauftrag": "Check task",
"Prüfbefehle (nur lesend):": "Check commands (read-only):",
"So sieht eine Meldung aus, wenn ein langer Befehl fertig ist und du nicht am Rechner bist.": "This is what a notification looks like when a long command finishes while you are away.",
"Verbindung gibt es nicht mehr": "The connection no longer exists",
"Volle Adresse, an die sshTermy JSON schickt (title, message, text, urgent).": "Full address sshTermy sends JSON to (title, message, text, urgent).",
"Zeitplan „%s“: KI-Prüfung fertig, %d in Ordnung, %d mit Befund": "Schedule “%s”: AI check done, %d fine, %d with findings",
"Zugangstoken, falls dein ntfy-Server eins verlangt. Leer = ohne.": "Access token, if your ntfy server needs one. Empty = none.",
"Zuletzt geschlossen · ⏎ öffnet mit der Ausgabe von damals": "Recently closed · ⏎ reopens with the output from back then",
"Zuletzt geschlossen …": "Recently closed …",
"Zuletzt geschlossene Tabs …": "Recently closed tabs …",
"Zweifel": "doubt",
"eigener Gotify-Server": "own Gotify server",
"in eigenen Worten · die KI wählt Befehle, die nur lesen, und meldet je Server, was auffällt": "in your own words · the AI picks commands that only read and reports per server what stands out",
"kein Urteil der KI": "no verdict from the AI",
"keine Handy-Meldungen": "no phone notifications",
"mit Ausgabe": "with output",
"nicht fertig geworden": "did not finish",
"ntfy braucht ein Thema in der Adresse, z. B. https://ntfy.sh/mein-geheimes-thema": "ntfy needs a topic in the address, e.g. https://ntfy.sh/my-secret-topic",
} {
en[de] = e
}
}
+21
View File
@@ -0,0 +1,21 @@
package i18n
// Ideen aus termilly, Paket D: Panel andocken, F5/Log-Blick daneben, Statuszeile je Bereich.
func init() {
for de, e := range map[string]string{
"F5 und Log-Blick füllen wieder die ganze Fläche": "F5 and log view fill the whole area again",
"F5 und Log-Blick neben dem Terminal (breite Fenster)": "F5 and log view beside the terminal (wide windows)",
"F5 und Log-Blick stehen in breiten Fenstern neben dem Terminal": "F5 and log view now sit beside the terminal in wide windows",
"Panelrand ziehen": "drag the panel edge",
"Panel breiter/höher (Palette: links, rechts, unten)": "panel wider/taller (palette: left, right, bottom)",
"Panel steht jetzt ": "Panel is now on the ",
"Panelgröße wieder automatisch": "Panel size automatic again",
"Seitenpanel andocken": "Dock the side panel",
"Statuszeile je Bereich (Ordner, letzter Befehl, Last)": "Status line per pane (folder, last command, load)",
"links": "left",
"rechts": "right",
"unten": "bottom",
} {
en[de] = e
}
}
+5
View File
@@ -0,0 +1,5 @@
package push
import "mime"
func mimeB(s string) string { return mime.BEncoding.Encode("UTF-8", s) }
+143
View File
@@ -0,0 +1,143 @@
// Package push schickt kurze Meldungen aufs Handy: über ntfy (eigener
// Server oder ntfy.sh), Gotify oder einen beliebigen Webhook (JSON).
// sshTermy nutzt das, wenn niemand am Rechner ist: langer Befehl fertig,
// Zeitplan gelaufen, Logwache, Agent wartet auf Freigabe. Den Text hat der
// Aufrufer schon gekürzt und von Geheimnissen befreit.
package push
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
"github.com/db9979/sshtermy/internal/i18n"
)
// Arten.
const (
Ntfy = "ntfy"
Gotify = "gotify"
Webhook = "webhook"
)
// Config: Ziel der Meldungen.
type Config struct {
Kind string // Ntfy, Gotify, Webhook
URL string // ntfy: https://ntfy.sh/thema · Gotify: https://gotify.example · Webhook: volle Adresse
Token string // ntfy: Zugangstoken (optional) · Gotify: App-Token · Webhook: Bearer (optional)
}
// Message: eine Meldung.
type Message struct {
Title string
Body string
Urgent bool // Fehler, Befund, Freigabe nötig: höhere Priorität
Click string // optional: Adresse beim Antippen (ntfy)
Category string // z. B. "befehl", "zeitplan", "freigabe" (Webhook)
}
// Client: in Tests austauschbar.
var Client = &http.Client{Timeout: 15 * time.Second}
// Check: Einstellungen plausibel?
func (c Config) Check() error {
u, err := url.Parse(strings.TrimSpace(c.URL))
if err != nil || u.Host == "" || (u.Scheme != "https" && u.Scheme != "http") {
return errors.New(i18n.T("Adresse mit http:// oder https:// angeben"))
}
switch c.Kind {
case Ntfy:
if strings.Trim(u.Path, "/") == "" {
return errors.New(i18n.T("ntfy braucht ein Thema in der Adresse, z. B. https://ntfy.sh/mein-geheimes-thema"))
}
case Gotify:
if c.Token == "" {
return errors.New(i18n.T("Gotify braucht ein App-Token"))
}
case Webhook:
default:
return errors.New(i18n.T("Art unbekannt"))
}
return nil
}
// Send schickt eine Meldung.
func Send(ctx context.Context, c Config, m Message) error {
if err := c.Check(); err != nil {
return err
}
base := strings.TrimRight(strings.TrimSpace(c.URL), "/")
var req *http.Request
var err error
switch c.Kind {
case Ntfy:
req, err = http.NewRequestWithContext(ctx, http.MethodPost, base, strings.NewReader(m.Body))
if err != nil {
return err
}
// Kopfzeilen sind nur ASCII sicher: ntfy versteht RFC 2047
req.Header.Set("Title", mimeWord(m.Title))
req.Header.Set("Tags", "computer")
if m.Urgent {
req.Header.Set("Priority", "high")
req.Header.Set("Tags", "warning,computer")
}
if m.Click != "" {
req.Header.Set("Click", m.Click)
}
if c.Token != "" {
req.Header.Set("Authorization", "Bearer "+c.Token)
}
case Gotify:
prio := 5
if m.Urgent {
prio = 8
}
b, _ := json.Marshal(map[string]any{"title": m.Title, "message": m.Body, "priority": prio})
req, err = http.NewRequestWithContext(ctx, http.MethodPost, base+"/message", bytes.NewReader(b))
if err != nil {
return err
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Gotify-Key", c.Token)
case Webhook:
b, _ := json.Marshal(map[string]any{"source": "sshTermy", "title": m.Title, "message": m.Body, "urgent": m.Urgent, "category": m.Category,
"text": m.Title + ": " + m.Body}) // „text“: Slack, Mattermost, Rocket.Chat
req, err = http.NewRequestWithContext(ctx, http.MethodPost, base, bytes.NewReader(b))
if err != nil {
return err
}
req.Header.Set("Content-Type", "application/json")
if c.Token != "" {
req.Header.Set("Authorization", "Bearer "+c.Token)
}
}
req.Header.Set("User-Agent", "sshTermy")
resp, err := Client.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode/100 != 2 {
msg, _ := io.ReadAll(io.LimitReader(resp.Body, 300))
return fmt.Errorf("%s: %s", resp.Status, strings.TrimSpace(string(msg)))
}
return nil
}
// mimeWord: Umlaute im Titel als =?UTF-8?B?…?= (RFC 2047).
func mimeWord(s string) string {
for _, r := range s {
if r > 126 || r < 32 {
return mimeB(s)
}
}
return s
}
+59
View File
@@ -0,0 +1,59 @@
package push
import (
"context"
"encoding/json"
"io"
"mime"
"net/http"
"net/http/httptest"
"testing"
)
func TestSend(t *testing.T) {
var got *http.Request
var body []byte
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
got, body = r, nil
body, _ = io.ReadAll(r.Body)
}))
defer srv.Close()
ctx := context.Background()
m := Message{Title: "sshTermy · Prüfung", Body: "web2: Platte voll", Urgent: true}
if err := Send(ctx, Config{Kind: Ntfy, URL: srv.URL + "/thema", Token: "tk"}, m); err != nil {
t.Fatal(err)
}
title, _ := new(mime.WordDecoder).DecodeHeader(got.Header.Get("Title"))
if got.URL.Path != "/thema" || string(body) != m.Body || title != m.Title || got.Header.Get("Priority") != "high" || got.Header.Get("Authorization") != "Bearer tk" {
t.Errorf("ntfy: %s %q %q %v", got.URL.Path, body, title, got.Header)
}
if err := Send(ctx, Config{Kind: Gotify, URL: srv.URL + "/", Token: "app"}, m); err != nil {
t.Fatal(err)
}
var g map[string]any
_ = json.Unmarshal(body, &g)
if got.URL.Path != "/message" || got.Header.Get("X-Gotify-Key") != "app" || g["message"] != m.Body || g["priority"] != float64(8) {
t.Errorf("gotify: %s %v", got.URL.Path, g)
}
if err := Send(ctx, Config{Kind: Webhook, URL: srv.URL + "/hook"}, m); err != nil {
t.Fatal(err)
}
_ = json.Unmarshal(body, &g)
if g["title"] != m.Title || g["source"] != "sshTermy" || got.Header.Get("Authorization") != "" {
t.Errorf("webhook: %v", g)
}
for _, c := range []Config{{Kind: Ntfy, URL: "https://ntfy.sh/"}, {Kind: Gotify, URL: "https://g.example"}, {Kind: "x", URL: "https://a"}, {Kind: Webhook, URL: "ftp://a"}} {
if c.Check() == nil {
t.Errorf("%+v sollte nicht gehen", c)
}
}
bad := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { http.Error(w, "nope", http.StatusForbidden) }))
defer bad.Close()
if err := Send(ctx, Config{Kind: Webhook, URL: bad.URL}, m); err == nil {
t.Error("403 nicht gemeldet")
}
}
+22
View File
@@ -477,3 +477,25 @@ func (l *Log) Transcript(maxBytes int) string {
}
return s
}
// Tail: die letzten Zeilen der Sitzung als Text (Prompt, Befehl, Ausgabe),
// für „Ausgabe vom letzten Mal“ in einem wieder geöffneten Tab.
func (l *Log) Tail(maxLines int) []string {
if l == nil || maxLines <= 0 {
return nil
}
pr := l.prompt()
var out []string
for i := len(l.Entries) - 1; i >= 0 && len(out) < maxLines; i-- {
e := l.Entries[i]
block := []string{pr + e.Command}
if o := strings.TrimRight(e.Output, "\n "); o != "" {
block = append(block, strings.Split(o, "\n")...)
}
out = append(block, out...)
}
if len(out) > maxLines {
out = out[len(out)-maxLines:]
}
return out
}
+35
View File
@@ -370,3 +370,38 @@ func (s *Store) ChangeConns(ids []string, f func(c *domain.Connection) bool) (in
}
return n, s.save()
}
// FolderTasks: Aufgaben eines Ordners (nur genau dieser Pfad).
func (s *Store) FolderTasks(path string) []domain.Task {
path = domain.NormPath(path)
s.mu.RLock()
defer s.mu.RUnlock()
if s.data == nil || path == "" {
return nil
}
if i := s.folderIdx(path); i >= 0 {
return append([]domain.Task(nil), s.data.Folders[i].Tasks...)
}
return nil
}
// SetFolderTasks ersetzt die Aufgaben eines Ordners.
func (s *Store) SetFolderTasks(path string, ts []domain.Task) error {
s.Fresh()
path = domain.NormPath(path)
if path == "" {
return errors.New(i18n.T("kein Ordner gewählt"))
}
if err := s.lockData(); err != nil {
return err
}
now := time.Now().UTC()
if len(ts) == 0 && s.folderIdx(path) < 0 {
s.mu.Unlock()
return nil
}
i := s.ensureFolder(path, now)
s.data.Folders[i].Tasks, s.data.Folders[i].UpdatedAt = ts, now
s.mu.Unlock()
return s.save()
}
+1 -1
View File
@@ -45,7 +45,7 @@ const (
// beim Bearbeiten weglassen und den Verlust zurück in den Sync schreiben.
// Mit der höheren Zahl verweigert es stattdessen den Abgleich (ErrTooNew),
// bis es aktualisiert ist. TestPayloadFields erinnert daran.
payloadFormat = 6
payloadFormat = 8
aadWrap = "sshtermy/v1/sync/wrap"
aadPayload = "sshtermy/v1/sync/payload"
minPassLen = 8
+7
View File
@@ -93,6 +93,13 @@ var localSettings = map[string]bool{
"RestoreTabs": true, // Tabs vom letzten Mal: je Rechner
"WebSearch": true, // Suchmaschine je Rechner
"NoHistGhost": true, // Ghost-Text aus dem Verlauf: je Rechner
"NoVerify": true, // Gegenprüfung: je Rechner
"Push": true, // Handy-Meldungen: je Rechner
"PanelDock": true, // Panel-Lage: je Bildschirm
"PanelW": true,
"PanelH": true,
"FilesBeside": true,
"NoPaneStatus": true,
}
// ownMerge: gehen mit dem Sync, aber pro Eintrag statt als Teil der
+18 -1
View File
@@ -1,4 +1,4 @@
format 6
format 8
payload.cmd_stats
payload.cmd_stats.at
payload.cmd_stats.conns
@@ -72,6 +72,14 @@ payload.connections.relay_system
payload.connections.serial_port
payload.connections.start_cmd
payload.connections.tags
payload.connections.tasks
payload.connections.tasks.created
payload.connections.tasks.due
payload.connections.tasks.id
payload.connections.tasks.note
payload.connections.tasks.state
payload.connections.tasks.text
payload.connections.tasks.updated
payload.connections.tunnel_ids
payload.connections.updated_at
payload.connections.username
@@ -87,6 +95,14 @@ payload.folders.created_at
payload.folders.id
payload.folders.order
payload.folders.path
payload.folders.tasks
payload.folders.tasks.created
payload.folders.tasks.due
payload.folders.tasks.id
payload.folders.tasks.note
payload.folders.tasks.state
payload.folders.tasks.text
payload.folders.tasks.updated
payload.folders.updated_at
payload.format
payload.known_hosts
@@ -146,6 +162,7 @@ payload.schedules.last_text
payload.schedules.machine
payload.schedules.name
payload.schedules.off
payload.schedules.prompt
payload.schedules.runbook_id
payload.schedules.steps
payload.schedules.updated_at
+1
View File
@@ -219,6 +219,7 @@ func Strip(c domain.Connection, o Options) domain.Connection {
c.LastUsed = time.Time{}
c.Note, c.StartCmd = "", "" // eigene Notiz und Startbefehl bleiben hier
c.FileMarks = nil // gemerkte Ordner sind persönlich
c.Tasks = nil // Aufgaben sind persönlich
return c
}
+9 -1
View File
@@ -108,6 +108,12 @@ func TestScrollbackMemory(t *testing.T) {
t.Skip("misst Speicher")
}
mb := sessionHeapMB(t, 2)
for i := 0; i < 3 && mb < 0; i++ {
mb = sessionHeapMB(t, 2) // anderer Test hat dazwischen Speicher freigegeben
}
if mb < 0 {
t.Skip("Messung gestört (Heap schrumpfte während der Messung)")
}
t.Logf("%.1f MB pro Tab mit vollem Verlauf", mb)
if mb > 20 {
t.Fatalf("%.1f MB pro Tab, erwartet unter 20", mb)
@@ -133,7 +139,9 @@ func sessionHeapMB(tb testing.TB, n int) float64 {
}
tm.Close()
}
return float64(m1.HeapAlloc-m0.HeapAlloc) / 1e6 / float64(n)
// vorzeichenbehaftet: gibt ein anderer Test dazwischen Speicher frei,
// wäre die Differenz ohne Vorzeichen riesig statt negativ
return float64(int64(m1.HeapAlloc)-int64(m0.HeapAlloc)) / 1e6 / float64(n)
}
// typische farbige Ausgabezeile (ls --color, Logs): ~150 Zeichen
+4
View File
@@ -524,6 +524,10 @@ func (a *App) agentKey(s *session, key string) (tea.Cmd, bool) {
return a.startFollowGoal(s), true
case "u":
return a.startUndo(s), true
case "d":
return a.showGoalDiff(s), true
case "g":
return a.startVerify(s), true
}
return nil, false
}
+2 -1
View File
@@ -177,6 +177,7 @@ func (a *App) viewAgentDone(b *strings.Builder, s *session, w int) {
}
keys = append(keys, [2]string{"f", i18n.T("Folgeziel")}, [2]string{"⏎", i18n.T("neues Ziel")})
b.WriteString(a.hintsIn(s, st.Muted, keys...))
a.viewVerify(b, s, w) // Gegenprüfung (goalverify.go)
a.viewBackups(b, s, w, "u")
}
@@ -192,7 +193,7 @@ func (a *App) agentPanelKeys(s *session) [][2]string {
k = append(k, [2]string{"r", i18n.T("aufräumen")}, [2]string{"v", i18n.T("Skript ansehen")})
}
if len(g.backups) > 0 {
k = append(k, [2]string{"u", i18n.T("zurückholen")})
k = append(k, [2]string{"d", i18n.T("Änderungen")}, [2]string{"u", i18n.T("zurückholen")})
}
return append(k, [2]string{"f", i18n.T("Folgeziel")}, [2]string{"⏎", i18n.T("neues Ziel")}, [2]string{"Esc", "Terminal"})
case !g.active:
+44 -18
View File
@@ -150,6 +150,8 @@ type App struct {
formBulk []string // Verbindungen der Sammeländerung (bulk.go)
searchAllLast string // letzter Suchbegriff der Suche über alle Tabs
tabDrag *tabDrag // Tab wird mit der Maus gezogen (tabs.go)
panelDrag bool // Panelrand wird gezogen (dock.go)
dragW, dragH int
formQuickPreset []string // Schnellbefehle: Vorbelegung zum Vergleich
formSID int // Schlüsseldatei-Abfrage: Sitzung, die danach neu verbindet
returnToTerminal bool
@@ -170,20 +172,22 @@ type App struct {
sdrag *splitDrag
dropOn int // Titel wird gezogen: Zielbereich+1
modal *modal
pal *palette
mst *menuState // Menü-Nutzung, Anheften, NEU (palstate.go)
llm llmUI
lh llmHealthState // KI-Status (llmhealth.go)
reach reachState // Online-Punkt im Manager (reach.go)
toasts []toastItem // Einblendungen oben rechts (toast.go)
perf perfState // Bildrate und Leistungsanzeige (perf.go)
styleGen int // zählt Theme-Wechsel (termView)
ovMemo overlayMemo // Hintergrund unter dem Modal (overlay)
toastTicking bool
animTicking bool // Takt für Bewegung (motion.go)
hov hoverState // Karte unter der Maus (motion.go)
rel *update.Release
modal *modal
taskL *taskList // Aufgabenliste (tasks.go)
tasksReminded bool // an fällige Aufgaben erinnert (tasks.go)
pal *palette
mst *menuState // Menü-Nutzung, Anheften, NEU (palstate.go)
llm llmUI
lh llmHealthState // KI-Status (llmhealth.go)
reach reachState // Online-Punkt im Manager (reach.go)
toasts []toastItem // Einblendungen oben rechts (toast.go)
perf perfState // Bildrate und Leistungsanzeige (perf.go)
styleGen int // zählt Theme-Wechsel (termView)
ovMemo overlayMemo // Hintergrund unter dem Modal (overlay)
toastTicking bool
animTicking bool // Takt für Bewegung (motion.go)
hov hoverState // Karte unter der Maus (motion.go)
rel *update.Release
// restartPending: installierte, noch nicht gestartete Version.
restartPending string
keeperDetach func(string) // Hintergrunddienst: Fenster abkoppeln (keeper.go)
@@ -194,10 +198,13 @@ type App struct {
mcpWaits []*mcpWaiter // MCP wait_tab, die noch warten (mcpcontrol.go)
jumpSID int // Tab der letzten Desktop-Meldung (notify.go)
jumpAt time.Time // … und wann sie kam
pushErrAt time.Time // letzte Fehlermeldung der Handy-Meldungen (pushnotify.go)
restoreArmed bool // Tabs vom letzten Mal angeboten, ab jetzt sichern (restore.go)
restoreAt time.Time // letzte Sicherung der offenen Tabs
restoreSig string // Inhalt der letzten Sicherung (nur bei Änderung schreiben)
restart bool // nach dem Beenden neu starten (siehe Restart)
closed []restoreTab // zuletzt geschlossene Tabs (closedtabs.go)
closedLoaded bool
restart bool // nach dem Beenden neu starten (siehe Restart)
lastKey time.Time
hl hlState // Farbregeln (highlight.go)
@@ -596,7 +603,11 @@ func (a *App) coreMsg(msg tea.Msg) (tea.Cmd, bool) {
if a.lock != nil {
return nil, true
}
return a.mouse(msg.(tea.MouseMsg)), true
cmd := a.mouse(msg.(tea.MouseMsg))
if a.scr == scrTerminal || a.scr == scrLogScan {
a.fitCurrent() // F5 daneben per Klick geschlossen: Terminal wieder breit (dock.go)
}
return cmd, true
case pasteMsg:
return a.onPaste(m), true
case pingDoneMsg:
@@ -711,6 +722,12 @@ func (a *App) featureMsg(msg tea.Msg) (tea.Cmd, bool) {
if cmd, ok := a.vulnFolderMsg(msg); ok {
return cmd, true
}
if cmd, ok := a.schedAIMsg(msg); ok {
return cmd, true
}
if cmd, ok := a.pushMsg(msg); ok {
return cmd, true
}
if cmd, ok := a.schedVulnMsg(msg); ok {
return cmd, true
}
@@ -817,13 +834,17 @@ func (a *App) screenMsg(msg tea.Msg) tea.Cmd {
case scrConnForm, scrSettings, scrTunnelForm, scrQuickForm, scrMonitorForm, scrFolderForm, scrHighlightForm, scrScheduleForm, scrRulesForm, scrCmdSetForm, scrKeyForm, scrSSHKeyForm, scrRelayForm, scrShareForm, scrRelaySetup, scrMasterForm, scrBackupForm, scrBulkForm:
return a.updateForm(msg)
case scrTerminal:
return a.updateTerminal(msg)
cmd := a.updateTerminal(msg)
a.fitCurrent() // F5 daneben auf/zu: Terminal breiter oder schmaler (dock.go)
return cmd
case scrSync:
return a.updateSync(msg)
case scrLogs:
return a.updateLogs(msg)
case scrLogScan:
return a.updateLogScan(msg)
cmd := a.updateLogScan(msg)
a.fitCurrent()
return cmd
case scrVuln:
return a.updateVuln(msg)
case scrPlayer:
@@ -906,6 +927,7 @@ func (a *App) onTick() tea.Cmd {
a.watchTick()
a.restoreTick(time.Now())
a.aiUsageTick(time.Now())
a.tasksReminder(time.Now())
a.mcpWaitTick(time.Now()) // MCP wait_tab (mcpcontrol.go)
if c := a.headerTick(time.Now()); c != nil {
cmds = append(cmds, c) // eigener Befehl in der Kopfzeile (headerfields.go)
@@ -988,6 +1010,10 @@ func (a *App) viewFrame() tea.View {
case scrLogs:
body = a.frame(a.viewLogs(), a.logsKeys())
case scrLogScan:
if a.logBeside(a.current()) {
body, _ = a.viewTerminal() // neben dem Terminal (dock.go)
break
}
body = a.frame(a.viewLogScan(), a.logScanKeys())
case scrVuln:
body = a.frame(a.viewVuln(), a.vulnKeys())
+182
View File
@@ -0,0 +1,182 @@
package ui
import (
"encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
"time"
tea "charm.land/bubbletea/v2"
"github.com/charmbracelet/x/ansi"
"github.com/db9979/sshtermy/internal/i18n"
)
// Ausgabe vom letzten Mal und „Zuletzt geschlossen“
//
// Öffnet sshTermy einen Tab wieder (nach dem Neustart oder aus der Liste
// der zuletzt geschlossenen Tabs), steht über der neuen Sitzung gedämpft,
// was zuletzt darin lief, mit einer Trennlinie. Die Zeilen kommen aus dem
// verschlüsselten Sitzungsprotokoll; ist es aus, bleibt der Tab leer. Die
// Liste der geschlossenen Tabs hält nur Verweise (wie restore-tabs.json).
const (
closedName = "closed-tabs.json"
closedMax = 10
closedMaxAge = 14 * 24 * time.Hour
oldOutLines = 200 // so viele Zeilen vom letzten Mal
)
// oldOutput: die letzten Zeilen aus dem Protokoll id, fertig für den Emulator.
func (a *App) oldOutput(id string) string {
if id == "" || !a.logsEnabled() {
return ""
}
b, err := a.logBook()
if err != nil {
return ""
}
l, err := b.Load(id)
if err != nil {
return ""
}
lines := l.Tail(oldOutLines)
if len(lines) == 0 {
return ""
}
when := l.Ended
if when.IsZero() && len(l.Entries) > 0 {
when = l.Entries[len(l.Entries)-1].At
}
return oldOutText(lines, when)
}
// oldOutText: gedämpfte Zeilen, Steuerzeichen entfernt, dann die Trennlinie.
func oldOutText(lines []string, when time.Time) string {
var b strings.Builder
b.WriteString("\x1b[0m\x1b[2m")
for _, ln := range lines {
b.WriteString(strings.Map(func(r rune) rune {
if r == '\t' {
return ' '
}
if r < 0x20 || r == 0x7f || (r >= 0x80 && r < 0xa0) {
return -1
}
return r
}, ansi.Strip(ln)))
b.WriteString("\r\n")
}
label := i18n.T("Ausgabe vom letzten Mal")
if !when.IsZero() {
label += " · " + when.Local().Format("02.01. 15:04")
}
fmt.Fprintf(&b, "\x1b[0m\x1b[2m── %s ──\x1b[0m\r\n", label)
return b.String()
}
// seedOld: im neuen Emulator vor der ersten Ausgabe des Servers (läuft im
// Verbindungs-Läufer, gleich nach termemu.New).
func (s *session) seedOld() {
if s.oldOut == "" || s.term == nil {
return
}
_, _ = s.term.Write([]byte(s.oldOut))
s.oldOut = ""
}
func (a *App) closedPath() string {
if a.st == nil || a.st.Dir == "" {
return ""
}
return filepath.Join(a.st.Dir, closedName)
}
func (a *App) loadClosed() {
if a.closedLoaded {
return
}
a.closedLoaded = true
p := a.closedPath()
if p == "" {
return
}
b, err := os.ReadFile(p)
if err != nil {
return
}
var l []restoreTab
if json.Unmarshal(b, &l) != nil {
return
}
for _, t := range l {
if time.Since(t.Closed) < closedMaxAge {
a.closed = append(a.closed, t)
}
}
}
func (a *App) saveClosed() {
p := a.closedPath()
if p == "" {
return
}
if len(a.closed) == 0 {
_ = os.Remove(p)
return
}
b, err := json.Marshal(a.closed)
if err == nil && os.WriteFile(p+".tmp", b, 0o600) == nil {
_ = os.Rename(p+".tmp", p)
}
}
// rememberClosed: aus closeTab, bevor das Protokoll endet.
func (a *App) rememberClosed(s *session) {
if s == nil || a.st == nil {
return
}
a.loadClosed()
t := a.tabRef(s)
t.Closed = time.Now()
a.closed = append([]restoreTab{t}, a.closed...)
if len(a.closed) > closedMax {
a.closed = a.closed[:closedMax]
}
a.saveClosed()
}
// openClosed: Liste der zuletzt geschlossenen Tabs, ⏎ öffnet wieder.
func (a *App) openClosed() tea.Cmd {
a.loadClosed()
if len(a.closed) == 0 {
a.flash(i18n.T("Noch kein Tab geschlossen"))
return nil
}
var items []menuItem
for i, t := range a.closed {
items = append(items, menuItem{label: a.restoreName(t), hint: ago(t.Closed), run: func() tea.Cmd {
return a.reopenClosed(i)
}})
}
return a.showMenu(i18n.T("Zuletzt geschlossen · ⏎ öffnet mit der Ausgabe von damals"), items)
}
// reopenClosed: Eintrag i wieder öffnen (und aus der Liste nehmen).
func (a *App) reopenClosed(i int) tea.Cmd {
if i < 0 || i >= len(a.closed) {
return nil
}
t := a.closed[i]
s, cmd := a.openRef(t)
if s == nil {
a.flashErr(i18n.T("Verbindung gibt es nicht mehr"))
return nil
}
a.closed = append(a.closed[:i:i], a.closed[i+1:]...)
a.saveClosed()
a.scr = scrTerminal
return cmd
}
+312
View File
@@ -0,0 +1,312 @@
package ui
import (
"strings"
"github.com/charmbracelet/x/ansi"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/i18n"
)
// Panel andocken: Das Seitenpanel (Ziel, KI fragen, Begleiter, Tunnel, F6)
// steht rechts (Standard), links oder unten. Breite bzw. Höhe zieht man mit
// der Maus am Rand des Panels; sshTermy merkt sie sich (je Rechner). Unten
// geht nur, wenn genug Zeilen da sind, sonst rechts. In schmalen Fenstern
// klappt das Panel wie bisher rechts zu einer Leiste ein.
const (
dockRight = ""
dockLeft = "left"
dockBottom = "bottom"
dockBottomMinH = 18 // darunter steht ein Panel unten nicht sinnvoll
panelMinW = 30
panelMinH = 6
)
var dockOrder = []string{dockRight, dockLeft, dockBottom}
func dockLabel(d string) string {
switch d {
case dockLeft:
return i18n.T("links")
case dockBottom:
return i18n.T("unten")
}
return i18n.T("rechts")
}
func (a *App) dockSetting() string {
if a.st == nil {
return dockRight
}
return a.st.Settings().PanelDock
}
// panelDock: wo das Panel dieser Sitzung gerade steht.
func (a *App) panelDock(s *session) string {
d := a.dockSetting()
if s == nil || s.panel == panelNone || a.panelCollapsed(s) {
return dockRight
}
if d == dockBottom && a.termRect(s).h < dockBottomMinH {
return dockRight
}
if s.panel == panelHost && s.host.live.wide {
return dockRight // F6 groß liegt ohnehin über allem
}
return d
}
// panelHeight: Zeilen des Panels unten.
func (a *App) panelHeight(s *session) int {
h := a.termRect(s).h
if _, n := a.panelSizes(); n > 0 {
return clamp(n, panelMinH, max(panelMinH, h-5))
}
return clamp(h*2/5, 8, max(8, h-5))
}
// termBox: Fläche des Terminals ohne Panel.
func (a *App) termBox(s *session) rect {
r := a.termRect(s)
if a.filesBeside(s) || a.logBeside(s) {
return rect{r.x, r.y, r.w - a.filesWidth(s), r.h}
}
if s == nil || s.panel == panelNone {
return r
}
switch a.panelDock(s) {
case dockLeft:
pw := a.panelWidth(s)
return rect{r.x + pw, r.y, max(20, r.w-pw), r.h}
case dockBottom:
return rect{r.x, r.y, r.w, max(3, r.h-a.panelHeight(s))}
}
return rect{r.x, r.y, max(20, r.w-a.panelWidth(s)), r.h}
}
// panelBox: Fläche, die das Panel gerade belegt (aufgeklappt mitgerechnet).
func (a *App) panelBox(s *session) rect {
r := a.termRect(s)
if s == nil || s.panel == panelNone {
return rect{}
}
switch a.panelDock(s) {
case dockLeft:
return rect{r.x, r.y, a.panelWidth(s), r.h}
case dockBottom:
ph := a.panelHeight(s)
return rect{r.x, r.y + r.h - ph, r.w, ph}
}
pw := a.panelShown(s)
return rect{r.x + r.w - pw, r.y, pw, r.h}
}
// dockCompose: Terminal und Panel zusammensetzen (links oder unten).
func (a *App) dockCompose(s *session, body string) string {
pb := a.panelBox(s)
switch a.panelDock(s) {
case dockLeft:
return beside(a.viewPanel(s, pb.w, pb.h), pb.w, body) // perf.go
case dockBottom:
tb := a.termBox(s)
lines := strings.Split(body, "\n")
if len(lines) > tb.h {
lines = lines[:tb.h]
}
for len(lines) < tb.h {
lines = append(lines, "")
}
return strings.Join(lines, "\n") + "\n" + a.viewPanel(s, pb.w, pb.h)
}
return beside(body, a.termBox(s).w, a.viewPanel(s, pb.w, pb.h))
}
func (a *App) cycleDock(dir int) tea.Cmd {
next := dockOrder[cycleIndex(dockIndex(a.dockSetting()), len(dockOrder), dir)]
_ = a.st.UpdateSettings(func(x *domain.Settings) { x.PanelDock = next })
a.resizeAll()
a.flash(i18n.T("Panel steht jetzt ") + dockLabel(next))
return nil
}
// ---------------------------------------------------------------- Größe ziehen
// panelEdge: liegt (x, y) auf dem Rand des Panels zum Terminal?
func (a *App) panelEdge(s *session, x, y int) bool {
if s == nil || s.panel == panelNone || a.panelCollapsed(s) || s.files.open {
return false
}
pb := a.panelBox(s)
if pb.w <= 0 || !a.termRect(s).has(x, y) {
return false
}
switch a.panelDock(s) {
case dockLeft:
return x == pb.x+pb.w-1 && y >= pb.y && y < pb.y+pb.h
case dockBottom:
return y == pb.y && x >= pb.x && x < pb.x+pb.w
}
return x == pb.x && y >= pb.y && y < pb.y+pb.h
}
// panelDragMouse: Panelrand mit der Maus ziehen. ok = Ereignis verbraucht.
func (a *App) panelDragMouse(msg tea.MouseMsg) (tea.Cmd, bool) {
m := msg.Mouse()
s := a.current()
if a.scr != scrTerminal || s == nil || a.modal != nil || a.pal != nil || a.pick != nil {
a.panelDrag = false
return nil, false
}
_, isClick := msg.(tea.MouseClickMsg)
_, isRelease := msg.(tea.MouseReleaseMsg)
_, isMotion := msg.(tea.MouseMotionMsg)
if !a.panelDrag {
if isClick && m.Button == tea.MouseLeft && a.panelEdge(s, m.X, m.Y) {
a.panelDrag = true
return nil, true
}
return nil, false
}
switch {
case isMotion:
r := a.termRect(s)
switch a.panelDock(s) {
case dockLeft:
a.setPanelSize(clamp(m.X-r.x+1, panelMinW, max(panelMinW, r.w-20)), 0)
case dockBottom:
a.setPanelSize(0, clamp(r.y+r.h-m.Y, panelMinH, max(panelMinH, r.h-5)))
default:
a.setPanelSize(clamp(r.x+r.w-m.X, panelMinW, max(panelMinW, r.w-20)), 0)
}
return nil, true
case isRelease:
a.panelDrag = false
_ = a.st.UpdateSettings(func(x *domain.Settings) { x.PanelW, x.PanelH = a.dragW, a.dragH })
return nil, true
}
return nil, true
}
// setPanelSize: während des Ziehens nur im Speicher, gespeichert beim Loslassen.
func (a *App) setPanelSize(w, h int) {
a.dragW, a.dragH = a.panelSizes()
if w > 0 {
a.dragW = w
}
if h > 0 {
a.dragH = h
}
a.resizeAll()
}
// resetPanelSize: Breite und Höhe wieder automatisch.
func (a *App) resetPanelSize() tea.Cmd {
_ = a.st.UpdateSettings(func(x *domain.Settings) { x.PanelW, x.PanelH = 0, 0 })
a.resizeAll()
a.flash(i18n.T("Panelgröße wieder automatisch"))
return nil
}
// panelSizes: gewünschte Breite/Höhe (0 = automatisch); beim Ziehen die
// gerade gezogene, gespeichert wird erst beim Loslassen.
func (a *App) panelSizes() (w, h int) {
if a.panelDrag {
return a.dragW, a.dragH
}
if a.st == nil {
return 0, 0
}
st := a.st.Settings()
return st.PanelW, st.PanelH
}
func dockIndex(d string) int {
for i, x := range dockOrder {
if x == d {
return i
}
}
return 0
}
// ---------------------------------------------------------------- F5 daneben
// filesBesideMinW: so breit muss die Fläche sein, damit F5 neben dem
// Terminal steht (sonst wie bisher über dem Terminal).
const filesBesideMinW = 140
func (s *session) filesFocus() bool { return s.files.open && !s.files.blur }
func (a *App) filesBesideOn() bool { return a.st != nil && a.st.Settings().FilesBeside }
// filesBeside: F5 steht gerade neben dem Terminal.
func (a *App) filesBeside(s *session) bool {
return s != nil && s.files.open && a.filesBesideOn() && a.termRect(s).w >= filesBesideMinW && !s.detached()
}
func (a *App) filesWidth(s *session) int {
w := a.termRect(s).w
return clamp(w*11/20, 70, w-60)
}
// filesRect: Fläche der Dateiansicht.
func (a *App) filesRect(s *session) rect {
r := a.termRect(s)
if a.filesBeside(s) {
fw := a.filesWidth(s)
return rect{r.x + r.w - fw, r.y, fw, r.h}
}
return r
}
func (a *App) toggleFilesBeside() tea.Cmd {
on := !a.filesBesideOn()
_ = a.st.UpdateSettings(func(x *domain.Settings) { x.FilesBeside = on })
a.resizeAll()
if on {
a.flash(i18n.T("F5 und Log-Blick stehen in breiten Fenstern neben dem Terminal"))
} else {
a.flash(i18n.T("F5 und Log-Blick füllen wieder die ganze Fläche"))
}
return nil
}
// fitCurrent: Terminalgröße nachziehen, wenn F5 oder der Log-Blick daneben
// auf- oder zugeht (resize tut nichts, wenn die Größe stimmt).
func (a *App) fitCurrent() {
if s := a.current(); s != nil {
a.resize(s)
}
}
// logBeside: Log-Blick steht neben dem Terminal der Sitzung (aus dem
// Terminal geöffnet, breites Fenster, keine geteilte Ansicht).
func (a *App) logBeside(s *session) bool {
return s != nil && a.scr == scrLogScan && a.lscan.back == scrTerminal && a.lscan.sid == s.id &&
a.filesBesideOn() && a.split == splitOff && a.termRect(s).w >= filesBesideMinW && !s.detached()
}
// logPaneView: Log-Blick in w×h (für daneben).
func (a *App) logPaneView(w, h int) string {
ow, oh := a.w, a.h
a.w, a.h = w+2, h+4 // viewLogScan rechnet mit dem ganzen Fenster
out := a.viewLogScan()
a.w, a.h = ow, oh
lines := strings.Split(out, "\n")
if len(lines) > h {
lines = lines[:h]
}
for i, l := range lines {
l = ansi.Truncate(l, w-2, "")
lines[i] = "│ " + l + strings.Repeat(" ", max(0, w-2-ansi.StringWidth(l)))
}
for len(lines) < h {
lines = append(lines, "│"+strings.Repeat(" ", w-1))
}
return strings.Join(lines, "\n")
}
+8 -1
View File
@@ -69,6 +69,7 @@ type xfer struct {
type filesState struct {
open bool
blur bool // daneben geöffnet, Tasten gehen gerade ans Terminal (dock.go)
opening bool
err string
remote *sshx.RemoteFS
@@ -104,16 +105,22 @@ func filesTick(sid int) tea.Cmd {
func (a *App) toggleFiles(s *session) tea.Cmd {
f := &s.files
if f.open && f.blur {
f.blur = false // daneben: F5 holt die Dateien nach vorn
return nil
}
if f.open {
f.open, f.view = false, nil
a.resize(s)
return nil
}
if s.conn.Protocol.Raw() {
a.flash(i18n.T("Dateien und Tunnel gibt es nur bei SSH-Verbindungen"))
return nil
}
f.open = true
f.open, f.blur = true, false
f.placeCache = [2][]place{}
a.resize(s) // daneben: Terminal wird schmaler
if f.remote != nil || f.opening || s.client == nil {
return nil
}
+1 -1
View File
@@ -1049,7 +1049,7 @@ func (a *App) viewPosAt(s *session, x, y int) (p viewPos, dy int, ok bool) {
if v == nil || len(v.vrows) == 0 {
return p, 0, false
}
r := a.termRect(s)
r := a.filesRect(s)
row := y - (r.y + 2)
if row < 0 {
dy = -1
+197
View File
@@ -0,0 +1,197 @@
package ui
// Änderungsvorschau: Ziel- und Agent-Modus sichern jede Datei, bevor ein
// Schritt sie ändert (goalux.go). d zeigt für jede dieser Dateien, was sich
// seitdem geändert hat, als Diff (vorher → jetzt), mit +/− je Datei. Gelesen
// wird der jetzige Stand über SFTP; ist eine Datei nur mit sudo lesbar,
// versucht sshTermy `sudo -n cat` (ohne Passwort, nur lesend). Danach holt u
// wie gewohnt alles zurück.
import (
"context"
"errors"
"fmt"
"io"
"io/fs"
"strings"
"time"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/hostinfo"
"github.com/db9979/sshtermy/internal/i18n"
"github.com/db9979/sshtermy/internal/sshx"
)
// fileNow: jetziger Stand einer gesicherten Datei.
type fileNow struct {
Path string
Exists bool
Content []byte
Err string
}
type goalDiffMsg struct {
sid int
list []fileBackup
now []fileNow
err error
}
// fileDiffStat: +/− Zeilen zwischen Sicherung und jetzt.
func fileDiffStat(b fileBackup, n fileNow) (lines []hostinfo.DiffLine, add, del int) {
split := func(x []byte) []string {
t := strings.ReplaceAll(string(x), "\r\n", "\n")
t = strings.TrimSuffix(t, "\n")
if t == "" {
return nil
}
return strings.Split(t, "\n")
}
var before, after []string
if b.Existed {
before = split(b.Content)
}
if n.Exists {
after = split(n.Content)
}
return hostinfo.Diff(before, after, 3)
}
// showGoalDiff liest den jetzigen Stand und zeigt den Diff.
func (a *App) showGoalDiff(s *session) tea.Cmd {
var list []fileBackup
for _, b := range s.goal.backups {
if b.restorable() {
list = append(list, b)
}
}
if len(list) == 0 {
a.flash(i18n.T("Keine gesicherten Änderungen zum Vergleichen"))
return nil
}
if s.state != stConnected || !a.agentFilesOK(s) {
a.flashErr(i18n.T("Vergleichen braucht eine Verbindung mit SFTP"))
return nil
}
a.flash(i18n.T("Lese den jetzigen Stand der Dateien …"))
sid := s.id
local, cl := s.agentFSOf()
return func() tea.Msg {
fsys, closeFn, err := agentFS(local, cl)
if err != nil {
return goalDiffMsg{sid: sid, list: list, err: err}
}
defer closeFn()
now := make([]fileNow, len(list))
for i, b := range list {
now[i] = readNow(fsys, cl, b)
}
return goalDiffMsg{sid: sid, list: list, now: now}
}
}
func readNow(fsys sshx.FS, cl *sshx.Client, b fileBackup) fileNow {
n := fileNow{Path: b.Path}
p := b.Path
if strings.HasPrefix(p, "~/") {
p = fsys.Join(fsys.Home(), p[2:])
}
e, err := fsys.Stat(p)
switch {
case errors.Is(err, fs.ErrNotExist):
return n // gelöscht
case err == nil && e.IsDir:
n.Err = i18n.T("ist jetzt ein Ordner")
return n
case err == nil && e.Size > maxBackupSize:
n.Err = i18n.T("zu groß")
return n
}
if err == nil {
if r, err := fsys.Open(p); err == nil {
data, err := io.ReadAll(io.LimitReader(r, maxBackupSize+1))
_ = r.Close()
if err == nil && len(data) <= maxBackupSize {
n.Exists, n.Content = true, data
return n
}
}
}
// nur mit sudo lesbar: ohne Passwort versuchen, sonst ehrlich sagen
if cl != nil && b.Sudo {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
res, err := cl.Exec(ctx, "sudo -n cat -- "+shQuote(p))
if err == nil && res.Exit == 0 && len(res.Output) <= maxBackupSize {
n.Exists, n.Content = true, res.Output
return n
}
}
n.Err = i18n.T("nicht lesbar")
return n
}
func (a *App) goalDiffDone(m goalDiffMsg) {
s := a.byID(m.sid)
if s == nil {
return
}
if m.err != nil {
a.flashErr(i18n.T("Vergleichen: ") + m.err.Error())
return
}
title, lines := a.goalDiffText(s, m.list, m.now)
a.modal = textModal(title, lines)
}
// goalDiffText: Kopf mit Summen, dann je Datei ein Abschnitt.
func (a *App) goalDiffText(s *session, list []fileBackup, now []fileNow) (string, []string) {
st := a.s
var out []string
sumAdd, sumDel, changed := 0, 0, 0
for i, b := range list {
n := now[i]
head := st.Accent.Render("▸ " + b.Path)
if n.Err != "" {
out = append(out, head+" "+st.Warn.Render(n.Err), "")
continue
}
lines, add, del := fileDiffStat(b, n)
switch {
case !b.Existed && n.Exists:
head += " " + st.OK.Render(i18n.T("neu angelegt"))
case b.Existed && !n.Exists:
head += " " + st.Danger.Render(i18n.T("gelöscht"))
}
if add+del == 0 && b.Existed == n.Exists {
out = append(out, head+" "+st.Muted.Render(i18n.T("unverändert")), "")
continue
}
changed++
sumAdd += add
sumDel += del
out = append(out, head+" "+st.OK.Render(fmt.Sprintf("+%d", add))+" "+st.Danger.Render(fmt.Sprintf("−%d", del)))
for j, l := range lines {
if j == 400 {
out = append(out, st.Muted.Render(fmt.Sprintf(i18n.T(" … %d weitere Zeilen"), len(lines)-400)))
break
}
switch l.Op {
case hostinfo.DiffHunk:
out = append(out, st.AI.Render(l.Text))
case hostinfo.DiffAdd:
out = append(out, st.OK.Render("+ "+l.Text))
case hostinfo.DiffDel:
out = append(out, st.Danger.Render("- "+l.Text))
default:
out = append(out, st.Muted.Render(" "+l.Text))
}
}
out = append(out, "")
}
out = append(out, st.Muted.Render(i18n.T("u im Panel holt alle Dateien zurück (so wie vor dem Ziel).")))
title := fmt.Sprintf(i18n.T("Änderungen auf %s · %s "), s.conn.Alias, plural(changed, i18n.T("Datei"), i18n.T("Dateien"))) +
st.OK.Render(fmt.Sprintf("+%d", sumAdd)) + " " + st.Danger.Render(fmt.Sprintf("−%d", sumDel))
return title, out
}
+3
View File
@@ -25,6 +25,9 @@ const goalHistShown = 5
// recordGoal schreibt das aktuelle Ziel in den Verlauf (einmal je Ziel).
func (a *App) recordGoal(s *session, state string) {
g := &s.goal
if !g.recorded && !g.undoing {
a.taskGoalEnded(s, state) // Aufgabe zur Abnahme bzw. wieder offen (tasks.go)
}
if g.recorded || strings.TrimSpace(g.goal) == "" || g.undoing {
return
}
+4 -1
View File
@@ -239,7 +239,7 @@ func (a *App) goalNotifyTick(s *session) {
a.flash(ic("ai") + " " + s.tabName() + ": " + why)
s.flashTab(a.s.T.Warn)
}
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() && time.Since(g.attnDesk) > 20*time.Second {
if a.notifyAway() && time.Since(g.attnDesk) > 20*time.Second {
g.attnDesk = time.Now()
body := why
if a.lock != nil {
@@ -651,6 +651,9 @@ func (a *App) viewBackups(b *strings.Builder, s *session, w int, key string) {
}
head := st.Warn.Render("← " + plural(len(g.backups), i18n.T("Datei geändert"), i18n.T("Dateien geändert")))
if n > 0 {
head += st.Muted.Render(" · ") + a.z.Click(st.Accent.Render("d")+" "+st.Text.Render(i18n.T("Änderungen")), func(tea.Mouse, bool) tea.Cmd {
return a.showGoalDiff(s)
})
head += st.Muted.Render(" · ") + a.z.Click(st.Accent.Render(key)+" "+st.Text.Render(i18n.T("zurückholen")), func(tea.Mouse, bool) tea.Cmd {
s.panelFocus = true
return a.startUndo(s)
+181
View File
@@ -0,0 +1,181 @@
package ui
// Gegenprüfung nach Ziel- und Agent-Modus: Meldet die KI „Ziel erreicht“,
// fragt sshTermy eine zweite, unabhängige KI-Anfrage (ein Ersatz-Anbieter,
// wenn eingerichtet, sonst dasselbe Modell mit frischem Blick). Sie darf bis
// zu drei rein lesende Prüfbefehle vorschlagen, die sshTermy unsichtbar in
// einem eigenen SSH-Kanal ausführt (nicht im Terminal, nichts wird
// geändert), und urteilt dann: bestätigt oder Zweifel, mit Befund. Steht im
// Panel unter „Ziel erreicht“; Zweifel kommen zusätzlich als Meldung.
// Standard: an. Abschaltbar (Palette „Gegenprüfung nach Ziel und Agent“),
// g im fertigen Panel prüft (noch einmal) von Hand.
import (
"context"
"errors"
"strings"
"time"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/agent"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/i18n"
"github.com/db9979/sshtermy/internal/llm"
)
type verifyState struct {
busy bool
model string
v agent.Verdict
checks []string
err string
seq int
started time.Time
}
type verifyMsg struct {
sid, seq int
checks []string
v agent.Verdict
err error
}
func (a *App) verifyOn() bool { return a.st == nil || !a.st.Settings().NoVerify }
func (a *App) toggleVerify() tea.Cmd {
on := !a.verifyOn()
if err := a.st.UpdateSettings(func(s *domain.Settings) { s.NoVerify = !on }); err != nil {
a.flash(i18n.T("Fehler: ") + err.Error())
return nil
}
if on {
a.flash(i18n.T("Gegenprüfung an: eine zweite KI prüft jedes erreichte Ziel nur lesend nach"))
} else {
a.flash(i18n.T("Gegenprüfung aus (g im fertigen Ziel prüft trotzdem)"))
}
return nil
}
// verifyAgent: Prüfer-KI. Ein eingerichteter Ersatz-Anbieter ist ein
// wirklich anderes Modell; sonst dasselbe Modell ohne den Verlauf des Ziels.
func (a *App) verifyAgent(s *session) (*agent.Agent, string, error) {
base, err := a.agentClientFor(s.conn)
if err != nil {
return nil, "", err
}
cfg := a.st.LLM()
if chain := cfg.Chain(); len(chain) > 1 {
alt := chain[1]
alt.Fallbacks, alt.FastModel = nil, ""
if c, err := llm.NewWithPrivacy(alt, a.aiLevel(s.conn)); err == nil {
return &agent.Agent{C: c, Rules: base.Rules}, alt.Model, nil
}
}
return base, cfg.Model, nil
}
// startVerify: Gegenprüfung des gerade erreichten Ziels.
func (a *App) startVerify(s *session) tea.Cmd {
g := &s.goal
if !g.done || g.goal == "" || len(g.steps) == 0 {
return nil
}
ag, model, err := a.verifyAgent(s)
if err != nil {
g.verify = &verifyState{err: err.Error()}
return nil
}
seq := 1
if g.verify != nil {
seq = g.verify.seq + 1
}
g.verify = &verifyState{busy: true, model: model, seq: seq, started: time.Now()}
sid := s.id
goal, reason := g.goal, g.doneReason
steps := append([]agent.DoneStep(nil), g.steps...)
c := a.agentContext(s, false)
cl := s.client
canRun := cl != nil && s.state == stConnected && !s.netDevice() && s.conn.Protocol != domain.ProtoWinRM
return func() tea.Msg {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
defer cancel()
var checks []string
var res []agent.CheckResult
if canRun {
cmds, err := ag.VerifyChecks(ctx, goal, reason, steps, c)
if err != nil && !errors.Is(err, agent.ErrUnreadable) {
return verifyMsg{sid: sid, seq: seq, err: err}
}
checks = cmds
for _, cmd := range cmds {
cctx, ccancel := context.WithTimeout(ctx, 20*time.Second)
r, err := cl.Exec(cctx, cmd)
ccancel()
out := string(r.Output)
if err != nil && out == "" {
out = err.Error()
}
res = append(res, agent.CheckResult{Command: cmd, Output: out, Exit: r.Exit})
}
}
v, err := ag.VerifyJudge(ctx, goal, reason, steps, res, c)
return verifyMsg{sid: sid, seq: seq, checks: checks, v: v, err: err}
}
}
func (a *App) verifyDone(m verifyMsg) {
s := a.byID(m.sid)
if s == nil || s.goal.verify == nil || s.goal.verify.seq != m.seq {
return
}
vs := s.goal.verify
vs.busy, vs.checks = false, m.checks
if m.err != nil {
vs.err = m.err.Error()
return
}
vs.v = m.v
a.taskVerified(s, m.v.OK, m.v.Finding)
if !m.v.OK {
a.pushToast(toastWarn, i18n.T("Gegenprüfung hat Zweifel: ")+trunc(m.v.Finding, 80))
if a.notifyAway() {
a.sendDesktopFor(s, i18n.T("Gegenprüfung hat Zweifel"), s.conn.Alias+": "+trunc(m.v.Finding, 120))
}
}
}
// viewVerify: Zeile(n) unter „Ziel erreicht“.
func (a *App) viewVerify(b *strings.Builder, s *session, w int) {
st := a.s
vs := s.goal.verify
if vs == nil {
if !a.verifyOn() && s.goal.done {
b.WriteString("\n" + st.Muted.Render(i18n.T("Gegenprüfung aus · g prüft jetzt")) + "\n")
}
return
}
b.WriteString("\n")
who := ""
if vs.model != "" {
who = st.Muted.Render(" · " + trunc(vs.model, 24))
}
switch {
case vs.busy:
b.WriteString(st.AI.Render(i18n.T("◌ Gegenprüfung läuft (nur lesend) …")) + who + "\n")
case vs.err != "":
b.WriteString(st.Muted.Render(i18n.T("Gegenprüfung nicht möglich: ")+trunc(vs.err, max(20, w-30))) + "\n")
case vs.v.OK:
b.WriteString(st.OK.Render(i18n.T("✓ Gegenprüfung bestätigt")) + who + "\n")
default:
b.WriteString(st.Warn.Render(i18n.T("▲ Gegenprüfung hat Zweifel")) + who + "\n")
}
if !vs.busy && vs.err == "" && vs.v.Finding != "" {
for _, l := range wrapText(vs.v.Finding, max(20, w-2)) {
b.WriteString(" " + st.Text.Render(l) + "\n")
}
}
if !vs.busy && len(vs.checks) > 0 {
b.WriteString(st.Muted.Render(" "+i18n.T("geprüft: ")+trunc(strings.Join(vs.checks, " · "), max(20, w-12))) + "\n")
}
}
+6 -1
View File
@@ -82,6 +82,7 @@ var helpSections = []helpSection{
{"m", "Broadcast an mehrere Hosts"},
{"f", "Netzwerk-Scan"},
{"z", "Zeitpläne"},
{"u", "Aufgaben (To-do) der Verbindung / des Ordners"},
{"s", "KI-Einstellungen"},
{"y", "Sync zwischen Rechnern"},
{"i", "Verbindungen importieren"},
@@ -122,7 +123,9 @@ var helpSections = []helpSection{
{"Strg+F", "im Verlauf suchen"},
{"Alt+C", "per Tastatur markieren: v / V, y kopiert"},
{"Alt+Y", "Zwischenablage-Verlauf: wieder einfügen"},
{"Alt+A", "Aufgaben dieser Verbindung"},
{"Rechtsklick auf Markierung", "kopieren, im Web suchen"},
{"Panelrand ziehen", "Panel breiter/höher (Palette: links, rechts, unten)"},
{"Alt+X", "Bildschirm + Verlauf leeren, Eingabe bleibt"},
{"Alt+S", "in allen Tabs suchen"},
{"Alt+O", "Befehle des Tabs: Ausgabe kopieren, an KI"},
@@ -152,6 +155,8 @@ var helpSections = []helpSection{
{"j n q Leertaste", "Befehl fragt nach: Antwort-Knöpfe"},
{"f", "Folgeziel (kennt die Schritte davor)"},
{"u", "Änderungen des Ziels zurückholen"},
{"d", "Änderungen als Diff ansehen"},
{"g", "Gegenprüfung (zweite KI, nur lesend)"},
{"⏎ nach Abbruch", "Ziel fortsetzen"},
{"↑ ↓", "Runbook oder früheres Ziel wählen"},
{"Strg+S", "als Runbook speichern"},
@@ -426,7 +431,7 @@ func (a *App) helpContext() helpCtx {
case scrScan:
return hcScan
case scrTerminal:
if s := a.current(); s != nil && s.files.open {
if s := a.current(); s != nil && s.filesFocus() {
return hcFiles
}
if s := a.current(); s != nil && s.search.open && !s.panelFocus {
+1 -1
View File
@@ -238,7 +238,7 @@ func (a *App) alertTick(s *session) {
msg += fmt.Sprintf(i18n.T(" (+%d weitere)"), len(hits)-1)
}
a.pushToast(toastWarn, msg)
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() {
if a.notifyAway() {
body := trunc(h.line, 100)
if a.lock != nil {
body = i18n.T("Farbregel hat angeschlagen") // gesperrt: keinen Inhalt verraten
+4
View File
@@ -89,6 +89,8 @@ const (
actNextNotice action = "next_notice"
actCopyMode action = "copy_mode"
actClipHist action = "clip_history"
actTasks action = "tasks"
actTasksTerm action = "tasks_terminal"
)
// Schnellbefehle ⇧F1 … ⇧F8 (manche Terminals senden dafür F13 … F20).
@@ -142,6 +144,7 @@ var actionDefs = []actionDef{
{actScrollBottom, "Zurück nach unten (Ende des Verlaufs)", "Terminal", []string{"shift+end"}},
{actCopyMode, "Markieren per Tastatur (v, y kopiert)", "Terminal", []string{"alt+c"}},
{actClipHist, "Zwischenablage-Verlauf (zuletzt Kopiertes einfügen)", "Terminal", []string{"alt+y"}},
{actTasksTerm, "Aufgaben dieser Verbindung", "Terminal", []string{"alt+a"}},
{actClearScreen, "Bildschirm und Verlauf leeren (Eingabezeile bleibt)", "Terminal", []string{"alt+x"}},
{actPrevCmd, "Zum vorigen Befehl springen", "Terminal", []string{"alt+pgup"}},
{actNextCmd, "Zum nächsten Befehl springen", "Terminal", []string{"alt+pgdown"}},
@@ -175,6 +178,7 @@ var actionDefs = []actionDef{
{actBroadcast, "Broadcast an mehrere Hosts", "Manager", []string{"m"}},
{actScan, "Netzwerk-Scan", "Manager", []string{"f"}},
{actWorkspace, "Arbeitsplätze", "Manager", []string{"w"}},
{actTasks, "Aufgaben der Verbindung bzw. des Ordners", "Manager", []string{"u"}},
{actFolderGrid, "Ordner als Raster öffnen", "Manager", []string{"g"}},
{actSchedule, "Zeitpläne (Broadcast/Runbook nach Uhrzeit)", "Manager", []string{"z"}},
}
+1
View File
@@ -103,6 +103,7 @@ func (a *App) openLogScan(s *session) tea.Cmd {
}
a.lscan.back = back
a.scr = scrLogScan
a.fitCurrent() // daneben: Terminal wird schmaler (dock.go)
a.lsApplyFocus()
if a.lscan.rep == nil && !a.lscan.busy {
return a.runLogScan(s)
+1 -1
View File
@@ -625,7 +625,7 @@ func (a *App) announceWatch(al watchAlert, sid int) {
if s := a.byID(sid); s != nil && !a.sessionVisible(s) {
s.notice = noticeLog
}
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() {
if a.notifyAway() {
if s := a.byID(sid); s != nil {
a.sendDesktopFor(s, "sshTermy · "+al.Host, al.Title)
} else {
+12 -1
View File
@@ -141,9 +141,17 @@ func (a *App) updateManager(msg tea.Msg) tea.Cmd {
}
}
switch a.keys.which(k.String(), actUndo, actManager, actHelp, actAbout, actImport, actNextLook, actKeys, actBroadcast, actScan, actCheat, actQuickEdit, actSSHKey,
actFolderNew, actRename, actMoveTo, actMoveUp, actMoveDown, actTagFilter, actFoldAll, actUnfoldAll, actWorkspace, actFolderGrid, actSchedule) {
actFolderNew, actRename, actMoveTo, actMoveUp, actMoveDown, actTagFilter, actFoldAll, actUnfoldAll, actWorkspace, actFolderGrid, actSchedule, actTasks) {
case actUndo:
return a.doUndo()
case actTasks:
if r, ok := a.mgrCur(); ok {
if r.isFolder() {
return a.openTasks("", r.node.Path)
}
return a.openTasks(r.conn.ID, r.conn.Group)
}
return nil
case actSchedule:
return a.openSchedules()
case actWorkspace:
@@ -668,6 +676,9 @@ func (a *App) mgrConnDetails(c domain.Connection, rightW int, now time.Time) str
row(k, l)
}
}
if tb := tasksBadge(append(append([]domain.Task(nil), c.Tasks...), a.folderTasksUp(c.Group)...), time.Now()); tb != "" {
row(i18n.T("Aufgaben"), tb)
}
if c.StartCmd != "" {
row(i18n.T("Startbefehl"), c.StartCmd)
}
+4
View File
@@ -270,6 +270,8 @@ func (a *App) modalKey(k tea.KeyPressMsg) tea.Cmd {
return a.dangerKey(k)
case mMenu:
return a.menuKey(key)
case mTasks:
return a.tasksKey(key)
case mLLM:
return a.llmStatusKey(key)
case mLayout:
@@ -374,6 +376,8 @@ func (a *App) modalView() string {
return a.dangerView(a.modal)
case mMenu:
return a.menuView(a.modal)
case mTasks:
return a.tasksView()
case mQuick:
return a.quickModalView(a.modal)
case mLLM:
+18 -8
View File
@@ -103,6 +103,11 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
return cmd
}
// Panelrand ziehen: Breite bzw. Höhe des Panels (dock.go)
if cmd, ok := a.panelDragMouse(msg); ok {
return cmd
}
// Tab mit gedrückter Taste ziehen: Reihenfolge ändern (tabs.go)
if a.tabDrag != nil && !isClick && !isWheel {
if a.scr != scrTerminal || a.modal != nil || a.pal != nil || a.pick != nil {
@@ -122,15 +127,19 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
if isClick {
a.focusSession(a.indexOf(p))
s = p
} else if isWheel && a.inTermArea(p, m.X, m.Y) && !p.files.open && !p.detached() {
} else if isWheel && a.inTermArea(p, m.X, m.Y) && !p.filesFocus() && !p.detached() {
return a.termMouse(p, msg, 0)
}
}
}
// F5 daneben: Klick wählt, ob Tasten ans Terminal oder an die Dateien gehen
if isClick && a.scr == scrTerminal && s != nil && a.modal == nil && a.pal == nil && a.pick == nil && a.filesBeside(s) {
s.files.blur = !a.filesRect(s).has(m.X, m.Y)
}
if a.scr == scrTerminal && s != nil && a.modal == nil && a.pal == nil && a.pick == nil {
if s.search.open && s.search.list && !s.selecting && a.inTermArea(s, m.X, m.Y) && !isWheel {
// Fehlerliste: Zeilen sind Zonen
} else if s.selecting || s.fwdHeld || (a.inTermArea(s, m.X, m.Y) && !s.files.open && s.state == stConnected && !s.detached()) {
} else if s.selecting || s.fwdHeld || (a.inTermArea(s, m.X, m.Y) && !s.filesFocus() && s.state == stConnected && !s.detached()) {
// ohne laufende Sitzung (Verbinden, Reconnect, beendet) zeigt die
// Fläche anklickbare Hinweise, die Klicks gehen an die Zonen
return a.termMouse(s, msg, clicks)
@@ -179,7 +188,7 @@ func (a *App) mouse(msg tea.MouseMsg) tea.Cmd {
return nil
}
// Dateien: Maustaste „Zurück“ = Betrachter zu bzw. eine Ebene hoch
if isClick && m.Button == tea.MouseBackward && a.scr == scrTerminal && s != nil && s.files.open && a.modal == nil && a.pal == nil && a.pick == nil {
if isClick && m.Button == tea.MouseBackward && a.scr == scrTerminal && s != nil && s.filesFocus() && a.modal == nil && a.pal == nil && a.pick == nil {
return a.filesBack(s, m.X, m.Y)
}
// Markieren im Datei-Betrachter
@@ -392,21 +401,22 @@ func (a *App) hintsIn(s *session, style lipgloss.Style, items ...[2]string) stri
func (a *App) inTermArea(s *session, x, y int) bool {
cols, rows := a.termSize(s)
r := a.termRect(s)
cols = min(cols, r.w-a.panelShown(s)) // aufgeklapptes Panel verdeckt einen Teil
r := a.termBox(s) // ohne Panel (dock.go)
if a.panelCollapsed(s) {
cols = min(cols, a.termRect(s).w-a.panelShown(s)) // aufgeklapptes Panel verdeckt einen Teil
}
return x >= r.x && x < r.x+cols && y >= r.y && y < r.y+rows
}
// inPanel: liegt (x, y) im Seitenpanel der Sitzung?
func (a *App) inPanel(s *session, x, y int) bool {
r := a.termRect(s)
return r.has(x, y) && x >= r.x+r.w-a.panelShown(s)
return a.panelBox(s).has(x, y)
}
func (a *App) termMouse(s *session, msg tea.MouseMsg, clicks int) tea.Cmd {
m := msg.Mouse()
cols, rows := a.termSize(s)
r := a.termRect(s)
r := a.termBox(s)
tx, ty := m.X-r.x, m.Y-r.y
if s.term == nil || s.state != stConnected || s.detached() {
return nil
+26 -5
View File
@@ -55,7 +55,7 @@ func (a *App) toggleDesktopNotify() tea.Cmd {
on := !a.desktopNotifyOn()
_ = a.st.UpdateSettings(func(s *domain.Settings) { s.NoDesktopNotify = !on })
if on {
a.sendDesktop(i18n.T("Desktop-Benachrichtigungen sind an"), i18n.T("So sieht eine Meldung aus, wenn ein langer Befehl fertig ist."))
desktopSend(i18n.T("Desktop-Benachrichtigungen sind an"), i18n.T("So sieht eine Meldung aus, wenn ein langer Befehl fertig ist."), nil)
}
return nil
}
@@ -83,7 +83,7 @@ func (a *App) cycleNotify(dir int) tea.Cmd {
s.NoDesktopNotify = next < 2
})
if next == 2 {
a.sendDesktop(i18n.T("Desktop-Benachrichtigungen sind an"), i18n.T("So sieht eine Meldung aus, wenn ein langer Befehl fertig ist."))
desktopSend(i18n.T("Desktop-Benachrichtigungen sind an"), i18n.T("So sieht eine Meldung aus, wenn ein langer Befehl fertig ist."), nil)
}
return nil
}
@@ -100,7 +100,14 @@ var desktopSend = func(title, body string, click func()) {
notify.SendClick(title, body, i18n.T("Öffnen"), click)
}
func (a *App) sendDesktop(title, body string) { desktopSend(title, body, nil) }
// Geht zusätzlich als Handy-Meldung raus, wenn eingerichtet und niemand am
// Rechner ist (pushnotify.go).
func (a *App) sendDesktop(title, body string) {
if a.desktopAway() {
desktopSend(title, body, nil)
}
a.pushSend(title, body)
}
// Klick auf eine Desktop-Meldung (oder zurück ins Fenster danach) führt in
// den Tab, um den es ging. Linux meldet den Klick (notify-send --action);
@@ -114,6 +121,10 @@ type notifyClickMsg struct{ sid int }
// sendDesktopFor: Meldung zu Tab s; merkt ihn für den Sprung.
func (a *App) sendDesktopFor(s *session, title, body string) {
a.pushSend(title, body)
if !a.desktopAway() {
return
}
a.jumpSID, a.jumpAt = s.id, time.Now()
ev, sid := a.events, s.id
desktopSend(title, body, func() {
@@ -187,6 +198,9 @@ func (a *App) noticeDone(s *session, cmd string, dur time.Duration, failed, inte
}
seen := a.sessionVisible(s) && !a.blurred
if seen {
if a.pushAway() { // vor dem Bildschirm, aber lange keine Taste: nur aufs Handy
a.pushSend("sshTermy · "+s.tabName(), trunc(cmd, 80)+" "+doneWord(failed)+" ("+fmtDur(dur)+")")
}
return
}
kind, word := noticeOK, i18n.T("fertig")
@@ -205,7 +219,7 @@ func (a *App) noticeDone(s *session, cmd string, dur time.Duration, failed, inte
} else {
a.flashOK(msg)
}
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() {
if a.notifyAway() {
body := trunc(cmd, 80) + " " + word
if a.lock != nil {
body = i18n.T("Befehl ") + word // gesperrt: keinen Befehl verraten
@@ -214,6 +228,13 @@ func (a *App) noticeDone(s *session, cmd string, dur time.Duration, failed, inte
}
}
func doneWord(failed bool) string {
if failed {
return i18n.T("fehlgeschlagen")
}
return i18n.T("fertig")
}
// noticeBell: BEL vom Server.
func (a *App) noticeBell(s *session) {
if !a.notifyOn() || (a.sessionVisible(s) && !a.blurred) {
@@ -227,7 +248,7 @@ func (a *App) noticeBell(s *session) {
}
s.bellAt = time.Now()
a.flash("♦ " + s.tabName() + ": " + i18n.T("Glocke (BEL) im Terminal"))
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() {
if a.notifyAway() {
a.sendDesktopFor(s, "sshTermy · "+s.tabName(), i18n.T("Glocke (BEL) im Terminal"))
}
}
+19
View File
@@ -243,6 +243,8 @@ func (a *App) palActions(s *session, inTerm, inMgr bool) []palItem {
if inMgr {
add("tabs", palItem{icon: ic("split"), label: i18n.T("Arbeitsplätze …"), hint: a.keys.label(actWorkspace), keys: "workspace layout", run: func() tea.Cmd { return a.openWorkspaces() }})
}
add("tabs", palItem{icon: ic("reconnect"), label: i18n.T("Zuletzt geschlossene Tabs …"), hint: i18n.T("mit Ausgabe"),
keys: "zuletzt geschlossen wieder öffnen reopen closed tab rückgängig undo close verlauf", run: func() tea.Cmd { return a.openClosed() }})
add("", palItem{icon: ic("sshkey"), label: i18n.T("Jetzt sperren"), hint: i18n.T("Master-Passwort"), run: func() tea.Cmd { return a.lockNow() }})
if a.Keeper() {
add("", palItem{icon: ic("reconnect"), label: i18n.T("Abkoppeln: Fenster zu, Sitzungen laufen weiter"), hint: "sshtermy",
@@ -606,6 +608,8 @@ func (a *App) palActsTerminal(add palAdd, s *session, inTerm bool) {
palItem{icon: ic("export"), label: i18n.T("Terminal-Verlauf als Text exportieren"), hint: ".txt", run: func() tea.Cmd { return a.exportScrollback(s) }},
palItem{icon: ic("copy"), label: i18n.T("Markieren per Tastatur (v, y kopiert)"), hint: a.keys.label(actCopyMode),
keys: "copy kopieren markieren auswahl tastatur keyboard select vi tmux copy-mode", run: func() tea.Cmd { a.startCopyMode(s); return nil }},
palItem{icon: ic("goal"), label: i18n.T("Aufgaben dieser Verbindung"), hint: a.keys.label(actTasksTerm),
keys: "aufgaben todo to-do tasks offen fällig erledigen abnahme liste pendenzen", run: func() tea.Cmd { return a.openTasks(s.conn.ID, s.conn.Group) }},
palItem{icon: ic("copy"), label: i18n.T("Zwischenablage-Verlauf (zuletzt Kopiertes einfügen)"), hint: a.keys.label(actClipHist),
keys: "zwischenablage clipboard verlauf history kopiert einfügen paste ringpuffer", run: func() tea.Cmd { return a.openClipHist() }},
palItem{icon: ic("open"), label: i18n.T("Zuletzt Kopiertes im Web suchen"), hint: func() string { _, e := a.searchEngine(); return e.label }(),
@@ -943,6 +947,19 @@ func (a *App) palMenuItems() []palItem {
"notify benachrichtigung glocke bell desktop", func(dir int) tea.Cmd { return a.cycleNotify(dir) }).at(a.notifyLevel(), 3),
hide(palToggle(ic("news"), i18n.T("Meldung, wenn lange Befehle im Hintergrund fertig sind"), a.notifyOn(), "notify benachrichtigung glocke bell", func() tea.Cmd { return a.toggleNotify() })),
hide(palToggle(ic("news"), i18n.T("Desktop-Benachrichtigung, wenn sshTermy im Hintergrund ist"), a.desktopNotifyOn(), "notify desktop benachrichtigung", func() tea.Cmd { return a.toggleDesktopNotify() })),
// nur über die Suche („Panel links“, „unten“); Rand mit der Maus ziehen ändert die Größe
hide(palCycle(pgSetBehave, ic("split"), i18n.T("Seitenpanel andocken"), dockLabel(a.dockSetting()),
"panel seitenpanel andocken dock links rechts unten left right bottom position seite breite höhe", func(dir int) tea.Cmd { return a.cycleDock(dir) }).at(dockIndex(a.dockSetting()), len(dockOrder))),
hide(palToggle(ic("split"), i18n.T("Statuszeile je Bereich (Ordner, letzter Befehl, Last)"), a.paneStatusOn(),
"status statuszeile bereich geteilt split ordner exit last load titel pane", func() tea.Cmd { return a.togglePaneStatus() })),
hide(palToggle(ic("files"), i18n.T("F5 und Log-Blick neben dem Terminal (breite Fenster)"), a.filesBesideOn(),
"dateien files f5 log-blick daneben nebeneinander seite beside side breit", func() tea.Cmd { return a.toggleFilesBeside() })),
hide(palItem{icon: ic("split"), label: i18n.T("Panelgröße wieder automatisch"), keys: "panel breite höhe größe zurücksetzen reset size width",
run: func() tea.Cmd { return a.resetPanelSize() }}),
// nur über die Suche („Handy“, „ntfy“), Hilfe und Webseite nennen den Weg
hide(palItem{icon: ic("news"), label: i18n.T("Handy-Meldungen (ntfy, Gotify, Webhook) …"), hint: pushKindLabel(a.st.Settings().Push.Kind),
keys: "handy smartphone push ntfy gotify webhook telefon mobil benachrichtigung unterwegs slack mattermost", run: func() tea.Cmd { return a.openPushSetup() }}),
hide(palItem{icon: ic("news"), label: i18n.T("Probemeldung ans Handy schicken"), keys: "handy push ntfy gotify webhook test probe", run: func() tea.Cmd { return a.pushTest() }}),
palToggle(ic("explain"), i18n.T("Tastenzeile: Tasten erklären"), a.cheatOn(), "cheat fußzeile footer", func() tea.Cmd { return a.toggleCheat() }),
// nur über die Suche („Tipps“), der Tipp selbst nennt den Weg
hide(palToggle(ic("keys"), i18n.T("Tipps zu Tasten"), a.tipsOn(), "tipp tipps tasten kürzel shortcut hint lernen", func() tea.Cmd { return a.toggleTips() })),
@@ -1071,6 +1088,8 @@ func (a *App) palMenuItems() []palItem {
keys: "ki ai datenschutz privacy anfrage request prompt gesendet", run: func() tea.Cmd { a.modal = a.lastRequestModal(); return nil }},
hide(look(palCycle(pgSetLook, ic("open"), i18n.T("Suchmaschine für „Im Web suchen“"), func() string { _, e := a.searchEngine(); return e.label }(),
"web suche suchmaschine search engine google duckduckgo bing startpage ecosia", func(dir int) tea.Cmd { return a.cycleSearchEngine(dir) }))),
hide(sub("settings/ki", palToggle(ic("ai"), i18n.T("Gegenprüfung nach Ziel und Agent (zweite KI, nur lesend)"), a.verifyOn(),
"gegenprüfung prüfen verify review zweite ki vier augen kontrolle bestätigen ziel agent", func() tea.Cmd { return a.toggleVerify() }))),
hide(sub("settings/ki", palToggle(ic("ai"), i18n.T("Ghost-Text zuerst aus dem Verlauf"), a.histGhostOn(),
"ghost text verlauf history vervollständigen autocomplete tab ohne ki offline", func() tea.Cmd { return a.toggleHistGhost() }))),
hide(palItem{group: pgSetSetup, menu: "settings/ki", icon: ic("ai"), label: i18n.T("KI-Verbrauch (Tokens, Kosten)"), keys: "ki ai verbrauch usage tokens kosten cost preis geld budget",
+1 -1
View File
@@ -34,7 +34,7 @@ func (a *App) palHereN(limit int) (string, []palItem) {
var items []menuItem
icon := ic("command")
switch {
case a.scr == scrTerminal && a.current() != nil && a.current().files.open:
case a.scr == scrTerminal && a.current() != nil && a.current().filesFocus():
s := a.current()
f := &s.files
if p := f.panes[f.side]; p != nil {
+18 -1
View File
@@ -83,6 +83,8 @@ type goalState struct {
lost bool // Verbindung war weg: wartet auf ⏎ zum Fortsetzen
manualNew bool // du hast nach dem Vorschlag selbst etwas ausgeführt
backups []fileBackup
task *goalTask // Ziel kam aus einer Aufgabe (tasks.go)
verify *verifyState // Gegenprüfung nach dem Ziel (goalverify.go)
backingUp bool
undoing bool // stellt gerade die Sicherungen wieder her
undoBack bool // nach Abbruch zurück zu „Ziel erreicht“
@@ -266,6 +268,10 @@ func (a *App) sessionMsg(msg tea.Msg) (tea.Cmd, bool) {
a.agentFinished(s)
a.flash(i18n.T("Agent: Ziel erreicht"))
}
g.verify = nil
if a.verifyOn() {
return a.startVerify(s), true // Gegenprüfung (goalverify.go)
}
case m.step.Question != "":
st := m.step
g.cur, g.optSel = &st, -1
@@ -296,6 +302,12 @@ func (a *App) sessionMsg(msg tea.Msg) (tea.Cmd, bool) {
return a.agentFileDone(m), true
case goalBackupMsg:
return a.goalBackupDone(m), true
case verifyMsg:
a.verifyDone(m)
return nil, true
case goalDiffMsg:
a.goalDiffDone(m)
return nil, true
case goalUndoMsg:
return a.goalUndoDone(m), true
case agentCleanMsg:
@@ -597,6 +609,10 @@ func (a *App) goalKey(s *session, msg tea.Msg) tea.Cmd {
return a.startFollowGoal(s)
case "u":
return a.startUndo(s)
case "d":
return a.showGoalDiff(s)
case "g":
return a.startVerify(s)
}
if key == "enter" || key == "x" {
g.done, g.rbSel, g.runbookID, g.recipe = false, -1, "", nil
@@ -890,7 +906,7 @@ func (a *App) panelKeys(s *session) [][2]string {
if g.done {
k := [][2]string{{"c", i18n.T("kopieren")}, {"l", i18n.T("ganz lesen")}, {"Strg+S", i18n.T("als Runbook merken")}, {"f", i18n.T("Folgeziel")}}
if len(g.backups) > 0 {
k = append(k, [2]string{"u", i18n.T("zurückholen")})
k = append(k, [2]string{"d", i18n.T("Änderungen")}, [2]string{"u", i18n.T("zurückholen")})
}
return append(k, [2]string{"⏎", i18n.T("neues Ziel")}, [2]string{"Esc", "Terminal"}, [2]string{a.keys.label(actGoal), i18n.T("schließen")})
}
@@ -1133,6 +1149,7 @@ func (a *App) viewGoal(b *strings.Builder, s *session, w int) {
hk = append(hk[:3:3], append([][2]string{{"r", i18n.T("Arbeitsordner löschen")}}, hk[3:]...)...)
}
b.WriteString(st.OK.Render(i18n.T("✓ Ziel erreicht")) + "\n" + wrap(st.Text.Render(g.doneReason), w) + "\n\n" + a.hintsIn(s, st.Muted, hk...))
a.viewVerify(b, s, w) // Gegenprüfung (goalverify.go)
a.viewBackups(b, s, w, "u")
if s.panelFocus && g.done {
g.active = false
+4 -5
View File
@@ -52,10 +52,9 @@ func selectablePanel(k panelKind) bool {
// begrenzt (Ziehen über den Rand); dy sagt dann, ob oben (-1) oder unten (+1)
// hinausgezogen wurde.
func (a *App) panelTextPos(s *session, x, y int, clampIt bool) (p pselPos, dy int, ok bool) {
r := a.termRect(s)
pw := a.panelShown(s)
x0, y0 := r.x+r.w-pw+2, r.y+1 // Rahmen + Innenabstand
w := pw - 4
pb := a.panelBox(s) // rechts, links oder unten (dock.go)
x0, y0 := pb.x+2, pb.y+1 // Rahmen + Innenabstand
w := pb.w - 4
vis := s.pscroll.vis
if s.pscroll.total <= vis || vis <= 0 {
vis = s.pscroll.total
@@ -79,7 +78,7 @@ func (a *App) panelTextPos(s *session, x, y int, clampIt bool) (p pselPos, dy in
// panelSelMouse: Markieren im Panel. ok = false: Ereignis gehört nicht hierher.
func (a *App) panelSelMouse(s *session, msg tea.MouseMsg, clicks int) (tea.Cmd, bool) {
if a.scr != scrTerminal || s == nil || a.modal != nil || a.pal != nil || a.pick != nil ||
!selectablePanel(s.panel) || s.files.open || (s.panel == panelHost && s.host.live.wide) {
!selectablePanel(s.panel) || s.filesFocus() || (s.panel == panelHost && s.host.live.wide) {
return nil, false
}
if a.panelCollapsed(s) && !s.panelFocus {
+92
View File
@@ -0,0 +1,92 @@
package ui
import (
"fmt"
"strings"
"time"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/i18n"
)
// Statuszeile je Bereich der geteilten Ansicht: In der Titelzeile jedes
// Bereichs steht rechts, was man sonst erst nach einem Wechsel sieht: der
// Ordner (OSC 7 oder Prompt), der laufende oder letzte Befehl mit Ergebnis
// und Dauer, die Last, wenn F6 sie kennt. Abschaltbar (Settings.NoPaneStatus).
func (a *App) paneStatusOn() bool { return a.st == nil || !a.st.Settings().NoPaneStatus }
func (a *App) togglePaneStatus() tea.Cmd {
on := !a.paneStatusOn()
_ = a.st.UpdateSettings(func(x *domain.Settings) { x.NoPaneStatus = !on })
return nil
}
// paneStatus: kurzer Text für die Titelzeile ("" = nichts zu sagen).
func (a *App) paneStatus(s *session, now time.Time) string {
if s == nil || !a.paneStatusOn() || s.state != stConnected || s.term == nil {
return ""
}
var parts []string
if d := shortDir(termDirOf(s)); d != "" {
parts = append(parts, d)
}
switch {
case s.run != nil:
parts = append(parts, "⠿ "+trunc(firstWord(s.run.cmd), 14)+" "+fmtDur(now.Sub(s.run.at)))
case len(s.blocks) > 0:
b := s.blocks[len(s.blocks)-1]
mark := "✓"
if b.failed {
mark = "×"
if b.exit != nil {
mark = fmt.Sprintf("× %d", *b.exit)
}
}
parts = append(parts, mark+" "+fmtDur(b.dur))
}
if h := s.host.srv; h != nil && h.HasLoad {
parts = append(parts, fmt.Sprintf(i18n.T("Last %.2f"), h.Load[0]))
}
return strings.Join(parts, " · ")
}
// termDirOf: Ordner des Terminals, wie er gemeldet oder im Prompt steht.
func termDirOf(s *session) string {
if p := s.term.Cwd(); p != "" {
return p
}
if s.term.AtIdlePrompt() {
return cwdFromPrompt(s.term.CursorLine())
}
return ""
}
// shortDir: höchstens die letzten zwei Teile, „…/“ davor.
func shortDir(p string) string {
if p == "" {
return ""
}
p = strings.TrimSuffix(strings.ReplaceAll(p, "\\", "/"), "/")
if p == "" {
return "/"
}
parts := strings.Split(p, "/")
if len(parts) > 3 {
p = "…/" + strings.Join(parts[len(parts)-2:], "/")
}
return trunc(p, 28)
}
func firstWord(cmd string) string {
f := strings.Fields(cmd)
if len(f) == 0 {
return ""
}
if (f[0] == "sudo" || f[0] == "time") && len(f) > 1 {
return f[0] + " " + f[1]
}
return f[0]
}
+1 -1
View File
@@ -368,7 +368,7 @@ func (a *App) withPerf(base string) string {
bw := lipgloss.Width(box)
x, y := a.w-bw-1, 1
if s := a.current(); a.scr == scrTerminal && s != nil {
tr := a.termRect(s)
tr := a.termBox(s)
cols, _ := a.paneSize(s)
y = tr.y
if cols >= bw+2 {
+225
View File
@@ -0,0 +1,225 @@
package ui
import (
"context"
"strings"
"sync"
"time"
"charm.land/bubbles/v2/textinput"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/agent"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/i18n"
"github.com/db9979/sshtermy/internal/push"
)
// Handy-Meldungen (ntfy, Gotify, Webhook)
//
// Was als Desktop-Meldung kommt (langer Befehl fertig, Zeitplan, Logwache,
// Farbregel, Agent oder Programm wartet auf Eingabe, Gegenprüfung mit
// Zweifel), geht zusätzlich aufs Handy, wenn niemand am Rechner ist: Fenster
// im Hintergrund, gesperrt oder pushIdle lang keine Taste. Der Text läuft
// durch denselben Geheimnisfilter wie bei der KI; gesperrt steht wie bei der
// Desktop-Meldung kein Befehl darin.
// pushIdle: so lange ohne Tastendruck gilt man als weg vom Rechner.
const pushIdle = 5 * time.Minute
// pushSame: dieselbe Meldung nicht öfter als einmal in dieser Zeit.
const pushSame = time.Minute
type pushErrMsg struct{ err error }
var pushRecent = struct {
sync.Mutex
at map[string]time.Time
}{at: map[string]time.Time{}}
// pushSendFn: in Tests austauschbar.
var pushSendFn = push.Send
func (a *App) pushCfg() push.Config {
p := a.st.Settings().Push
return push.Config{Kind: p.Kind, URL: p.URL, Token: string(p.Token)}
}
func (a *App) pushOn() bool { return a.st.Settings().Push.Kind != "" }
// desktopAway: Desktop-Meldung jetzt sinnvoll?
func (a *App) desktopAway() bool { return (a.blurred || a.lock != nil) && a.desktopNotifyOn() }
// pushAway: Handy-Meldung jetzt sinnvoll?
func (a *App) pushAway() bool {
if !a.pushOn() {
return false
}
idle := !a.lastKey.IsZero() && time.Since(a.lastKey) > pushIdle
return a.blurred || a.lock != nil || idle
}
// notifyAway: soll eine Meldung nach außen (Desktop oder Handy)?
func (a *App) notifyAway() bool { return a.desktopAway() || a.pushAway() }
// pushSend: Meldung ans Handy, im Hintergrund.
func (a *App) pushSend(title, body string) {
if !a.pushAway() {
return
}
cfg := a.pushCfg()
title, body = trunc(agent.Redact(title), 120), trunc(agent.Redact(body), 400)
key := title + "\x00" + body
pushRecent.Lock()
if time.Since(pushRecent.at[key]) < pushSame {
pushRecent.Unlock()
return
}
pushRecent.at[key] = time.Now()
pushRecent.Unlock()
urgent := strings.ContainsAny(title+body, "×◆") || containsAny(title+body, i18n.T("fehlgeschlagen"), i18n.T("Befund"), i18n.T("Zweifel"), i18n.T("wartet"))
ev := a.events
go func() {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
if err := pushSendFn(ctx, cfg, push.Message{Title: title, Body: body, Urgent: urgent}); err != nil && ev != nil {
select {
case ev <- pushErrMsg{err}:
default:
}
}
}()
}
func (a *App) pushErr(err error) {
if time.Since(a.pushErrAt) < 10*time.Minute {
return // nicht bei jeder Meldung erneut
}
a.pushErrAt = time.Now()
a.pushToast(toastWarn, i18n.T("Handy-Meldung ging nicht raus: ")+err.Error())
}
func pushKindLabel(k string) string {
switch k {
case push.Ntfy:
return "ntfy"
case push.Gotify:
return "Gotify"
case push.Webhook:
return "Webhook"
}
return i18n.T("aus")
}
// openPushSetup: Art wählen, dann Adresse und Token, dann Probemeldung.
func (a *App) openPushSetup() tea.Cmd {
cur := a.st.Settings().Push
var items []menuItem
for _, k := range []string{push.Ntfy, push.Gotify, push.Webhook, ""} {
hint := map[string]string{
push.Ntfy: i18n.T("App ntfy, eigener Server oder ntfy.sh"),
push.Gotify: i18n.T("eigener Gotify-Server"),
push.Webhook: i18n.T("JSON an eine Adresse (Slack, Mattermost, Home Assistant …)"),
"": i18n.T("keine Handy-Meldungen"),
}[k]
label := pushKindLabel(k)
if k == cur.Kind {
label = "● " + label
}
items = append(items, menuItem{label: label, hint: hint, run: func() tea.Cmd {
if k == "" {
_ = a.st.UpdateSettings(func(s *domain.Settings) { s.Push = domain.PushConfig{} })
a.flash(i18n.T("Handy-Meldungen aus"))
return nil
}
return a.askPushURL(k, cur)
}})
}
return a.showMenu(i18n.T("Handy-Meldungen, wenn du nicht am Rechner bist"), items)
}
func (a *App) askPushURL(kind string, cur domain.PushConfig) tea.Cmd {
val := ""
if cur.Kind == kind {
val = cur.URL
}
body := map[string]string{
push.Ntfy: i18n.T("Adresse mit Thema, z. B. https://ntfy.sh/ein-langes-zufälliges-thema (das Thema wirkt wie ein Passwort). In der ntfy-App dasselbe Thema abonnieren."),
push.Gotify: i18n.T("Adresse des Gotify-Servers, z. B. https://gotify.example.org"),
push.Webhook: i18n.T("Volle Adresse, an die sshTermy JSON schickt (title, message, text, urgent)."),
}[kind]
m := inputModal(i18n.T("Handy-Meldungen: ")+pushKindLabel(kind), body, val, func(u string) tea.Cmd {
cfg := push.Config{Kind: kind, URL: u, Token: "x"}
if err := cfg.Check(); err != nil {
a.flashErr(err.Error())
return a.askPushURL(kind, domain.PushConfig{Kind: kind, URL: u})
}
return a.askPushToken(kind, u, cur)
})
m.in.Placeholder = "https://"
a.modal = m
return m.in.Focus()
}
func (a *App) askPushToken(kind, u string, cur domain.PushConfig) tea.Cmd {
body := i18n.T("Zugangstoken, falls dein ntfy-Server eins verlangt. Leer = ohne.")
switch kind {
case push.Gotify:
body = i18n.T("App-Token aus Gotify (Apps › Anlegen).")
case push.Webhook:
body = i18n.T("Optional: wird als „Authorization: Bearer …“ mitgeschickt. Leer = ohne.")
}
if cur.Kind == kind && cur.Token.IsSet() {
body += "\n" + i18n.T("Leer lassen behält das gespeicherte Token.")
}
m := inputModal(i18n.T("Handy-Meldungen: Token"), body, "", func(tok string) tea.Cmd {
t := domain.Secret(tok)
if tok == "" && cur.Kind == kind {
t = cur.Token
}
cfg := push.Config{Kind: kind, URL: u, Token: string(t)}
if err := cfg.Check(); err != nil {
a.flashErr(err.Error())
return nil
}
_ = a.st.UpdateSettings(func(s *domain.Settings) { s.Push = domain.PushConfig{Kind: kind, URL: strings.TrimSpace(u), Token: t} })
return a.pushTest()
})
m.in.EchoMode = textinput.EchoPassword
m.in.Placeholder = ""
a.modal = m
return m.in.Focus()
}
type pushTestMsg struct{ err error }
// pushTest: Probemeldung, gleich nach dem Einrichten.
func (a *App) pushTest() tea.Cmd {
if !a.pushOn() {
a.flash(i18n.T("Handy-Meldungen sind aus"))
return nil
}
cfg := a.pushCfg()
a.flash(i18n.T("Probemeldung wird geschickt …"))
return func() tea.Msg {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
return pushTestMsg{pushSendFn(ctx, cfg, push.Message{Title: "sshTermy", Body: i18n.T("So sieht eine Meldung aus, wenn ein langer Befehl fertig ist und du nicht am Rechner bist.")})}
}
}
func (a *App) pushMsg(msg tea.Msg) (tea.Cmd, bool) {
switch m := msg.(type) {
case pushTestMsg:
if m.err != nil {
a.flashErr(i18n.T("Probemeldung ging nicht raus: ") + m.err.Error())
} else {
a.flashOK(i18n.T("Probemeldung verschickt, schau aufs Handy"))
}
return nil, true
case pushErrMsg:
a.pushErr(m.err)
return nil, true
}
return nil, false
}
+1
View File
@@ -54,6 +54,7 @@ func (a *App) connectRawCmd(s *session, cols, rows int, keepTerm bool) tea.Cmd {
if !keepTerm || s.term == nil {
s.term = termemu.New(cols, rows, shellWriter{s})
s.pixelImages() // pixelgenaue Bilder, wenn das Terminal es kann (pixels.go)
s.seedOld() // Ausgabe vom letzten Mal (closedtabs.go)
}
fail := func(err error) tea.Msg {
if !keepTerm {
+53 -28
View File
@@ -49,7 +49,9 @@ type restoreTab struct {
Adhoc *domain.Connection `json:"adhoc,omitempty"` // nicht gespeicherte Verbindung, ohne Geheimnisse
Mux string `json:"mux,omitempty"`
MuxName string `json:"mux_name,omitempty"`
Title string `json:"title,omitempty"` // umbenannter Tab
Title string `json:"title,omitempty"` // umbenannter Tab
LogID string `json:"log_id,omitempty"` // Sitzungsprotokoll: Ausgabe vom letzten Mal
Closed time.Time `json:"closed,omitzero"` // nur „Zuletzt geschlossen“
}
type restoreState struct {
@@ -96,12 +98,7 @@ func (a *App) saveRestoreAs(reason string) {
}
tabOf[s.id] = len(st.Tabs)
s.checkMuxGone()
t := restoreTab{Mux: s.mux.kind, MuxName: s.mux.name, Title: s.title}
if _, ok := a.st.Connection(s.conn.ID); ok && s.conn.ID != "" {
t.ConnID = s.conn.ID
} else {
t.Adhoc = adhocCopy(s.conn)
}
t := a.tabRef(s)
if i == a.cur {
st.Active = len(st.Tabs)
}
@@ -277,28 +274,11 @@ func (a *App) openRestored(st *restoreState) tea.Cmd {
first := len(a.sessions)
made := make([]*session, len(st.Tabs)) // Tab-Nummer → neue Sitzung
for ti, t := range st.Tabs {
var c domain.Connection
switch {
case t.ConnID != "":
cc, ok := a.st.Connection(t.ConnID)
if !ok {
continue // inzwischen gelöscht (z. B. per Sync)
}
c = cc
case t.Adhoc != nil && (t.Adhoc.Host != "" || t.Adhoc.Protocol.NoHost()):
c = *t.Adhoc
default:
continue
}
cmd := a.connect(c)
if s := a.current(); s != nil {
s.title = t.Title
made[ti] = s
}
// Feste Sitzung: hängt sich nach dem Verbinden selbst an (geteilt, ohne -d)
if s := a.current(); s != nil && (t.Mux == "tmux" || t.Mux == "screen") && !c.Protocol.Raw() && c.Persist == "" {
s.mux, s.muxPending = muxState{kind: t.Mux, name: t.MuxName}, true
s, cmd := a.openRef(t)
if s == nil {
continue // inzwischen gelöscht (z. B. per Sync)
}
made[ti] = s
cmds = append(cmds, cmd)
}
n := len(a.sessions) - first
@@ -318,6 +298,51 @@ func (a *App) openRestored(st *restoreState) tea.Cmd {
return tea.Batch(cmds...)
}
// tabRef: Verweis auf den Tab, ohne Geheimnisse.
func (a *App) tabRef(s *session) restoreTab {
t := restoreTab{Mux: s.mux.kind, MuxName: s.mux.name, Title: s.title}
if _, ok := a.st.Connection(s.conn.ID); ok && s.conn.ID != "" {
t.ConnID = s.conn.ID
} else {
t.Adhoc = adhocCopy(s.conn)
}
if s.log != nil && len(s.log.Entries) > 0 && a.logsEnabled() {
t.LogID = s.log.ID
} else if a.logsEnabled() {
t.LogID = s.oldLog // seit dem Wiederöffnen nichts getippt
}
return t
}
// openRef verbindet einen gemerkten Tab; nil, wenn die Verbindung fehlt.
func (a *App) openRef(t restoreTab) (*session, tea.Cmd) {
var c domain.Connection
switch {
case t.ConnID != "":
cc, ok := a.st.Connection(t.ConnID)
if !ok {
return nil, nil
}
c = cc
case t.Adhoc != nil && (t.Adhoc.Host != "" || t.Adhoc.Protocol.NoHost()):
c = *t.Adhoc
default:
return nil, nil
}
old := a.oldOutput(t.LogID)
cmd := a.connect(c)
s := a.current()
if s == nil {
return nil, cmd
}
s.title, s.oldOut, s.oldLog = t.Title, old, t.LogID
// Feste Sitzung: hängt sich nach dem Verbinden selbst an (geteilt, ohne -d)
if (t.Mux == "tmux" || t.Mux == "screen") && !c.Protocol.Raw() && c.Persist == "" {
s.mux, s.muxPending = muxState{kind: t.Mux, name: t.MuxName}, true
}
return s, cmd
}
// restoreSplit stellt die geteilte Ansicht von vor dem Neustart wieder her.
func (a *App) restoreSplit(m splitMode, st *restoreState, made []*session) {
cur := a.current()
+2 -1
View File
@@ -102,12 +102,13 @@ func TestGuardCmdNested(t *testing.T) {
}
func TestOutputPanicDropsBlock(t *testing.T) {
_ = safetyApp(t)
a := safetyApp(t)
w := outWriter{s: nil, ev: nil} // nil-Sitzung: write0 stürzt ab
n, err := w.Write([]byte("hallo"))
if n != 5 || err != nil {
t.Fatalf("Block muss verworfen werden, Verbindung bleibt: %d %v", n, err)
}
waitCaught(t, a) // Bericht fertig, bevor der Testordner verschwindet
}
func TestWithoutHandlerPanicsStillSurface(t *testing.T) {
+202
View File
@@ -0,0 +1,202 @@
package ui
import (
"context"
"errors"
"fmt"
"regexp"
"sort"
"strconv"
"strings"
"time"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/agent"
"github.com/db9979/sshtermy/internal/broadcast"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/i18n"
)
// KI-Prüfung als Zeitplan-Art (agent/schedcheck.go): Die KI wählt einmal
// bis zu fünf rein lesende Befehle, sie laufen in einer Zeile auf jedem
// Server (mit Trennmarken, damit ein Fehler die übrigen nicht aufhält),
// dann urteilt die KI je Host. Ergebnis wie bei jedem Zeitplan: Toast,
// Desktop- und Handy-Meldung, Text in der Zeitplanliste.
type schedAIMsg struct {
id string
cmds []string
outs []agent.HostOutput
verdicts []agent.HostVerdict
sum string
err error
}
const schedMark = "@@sshtermy-check"
// schedAILine: alle Prüfbefehle in einer Zeile, jeder mit Marke und Exit.
func schedAILine(cmds []string) string {
var parts []string
for i, c := range cmds {
parts = append(parts, fmt.Sprintf("echo '%s %d@@'; { %s; } 2>&1; echo \"%s-exit $?@@\"", schedMark, i, c, schedMark))
}
return strings.Join(parts, "; ")
}
var schedMarkRe = regexp.MustCompile(`(?m)^` + regexp.QuoteMeta(schedMark) + ` (\d+)@@\r?$`)
var schedExitRe = regexp.MustCompile(regexp.QuoteMeta(schedMark) + `-exit (\d+)@@`)
// schedAISplit: Ausgabe der Zeile wieder je Befehl.
func schedAISplit(out string, cmds []string) []agent.CheckResult {
res := make([]agent.CheckResult, len(cmds))
for i, c := range cmds {
res[i] = agent.CheckResult{Command: c, Exit: -1}
}
locs := schedMarkRe.FindAllStringSubmatchIndex(out, -1)
for j, l := range locs {
i, _ := strconv.Atoi(out[l[2]:l[3]])
if i < 0 || i >= len(cmds) {
continue
}
end := len(out)
if j+1 < len(locs) {
end = locs[j+1][0]
}
body := out[l[1]:end]
if m := schedExitRe.FindStringSubmatchIndex(body); m != nil {
res[i].Exit, _ = strconv.Atoi(body[m[2]:m[3]])
body = body[:m[0]]
}
res[i].Output = strings.Trim(body, "\r\n")
}
return res
}
// schedAIContext: Material für die KI (Systeme der Hosts, kurz).
func schedAIContext(sc domain.Schedule, conns []domain.Connection) (agent.Context, []string) {
c := agent.Context{Host: orDefault(sc.Folder, i18n.T("Zeitplan")), Now: time.Now()}
count := map[string]int{}
var hosts, lines []string
for _, x := range conns {
hosts = append(hosts, x.Alias)
if x.Profile != nil && x.Profile.OS != "" {
count[x.Profile.OS]++
if len(lines) < 30 {
lines = append(lines, x.Alias+": "+x.Profile.OS)
}
}
}
best := 0
for os, n := range count {
if n > best || (n == best && os < c.OS) {
c.OS, best = os, n
}
}
sort.Strings(lines)
c.Profile = strings.Join(lines, "\n")
return c, hosts
}
func (a *App) startScheduleAI(sc domain.Schedule, conns []domain.Connection) tea.Cmd {
id := sc.ID
ag, err := a.agentClientFor(conns...)
if err != nil {
return func() tea.Msg { return schedDoneMsg{id: id, err: err} }
}
actx, hosts := schedAIContext(sc, conns)
dial := schedDialer(a)
prompt := sc.Prompt
a.flash(i18n.T("Zeitplan startet: ") + sc.Name)
return func() tea.Msg {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
defer cancel()
m := schedAIMsg{id: id}
m.cmds, m.err = ag.SchedChecks(ctx, prompt, hosts, actx)
if m.err == nil && len(m.cmds) == 0 {
m.err = errors.New(i18n.T("Die KI hat keinen Befehl vorgeschlagen, der sicher nur liest"))
}
if m.err != nil {
return m
}
job := broadcast.Job{Conns: conns, Steps: []string{schedAILine(m.cmds)}, Timeout: 2 * time.Minute}
res := broadcast.Run(ctx, job, dial, func(int, broadcast.Result) {})
for _, r := range res {
o := agent.HostOutput{Host: r.Alias}
if r.Err != "" || r.State != broadcast.Done {
o.Err = orDefault(r.Err, i18n.T("nicht fertig geworden"))
} else {
o.Results = schedAISplit(r.Output, m.cmds)
}
m.outs = append(m.outs, o)
}
m.verdicts, m.sum, m.err = ag.SchedJudge(ctx, prompt, m.outs, actx)
return m
}
}
// schedAIReport: Text für die Zeitplanliste, Zahl der Hosts ok / mit Befund.
func schedAIReport(m schedAIMsg) (text string, okN, badN int) {
var b strings.Builder
if m.sum != "" {
b.WriteString(m.sum + "\n\n")
}
judged := map[string]agent.HostVerdict{}
for _, v := range m.verdicts {
judged[v.Host] = v
}
for _, o := range m.outs {
v, ok := judged[o.Host]
switch {
case o.Err != "":
badN++
fmt.Fprintf(&b, "× %s: %s\n", o.Host, o.Err)
case !ok:
fmt.Fprintf(&b, "? %s: %s\n", o.Host, i18n.T("kein Urteil der KI"))
case v.OK:
okN++
fmt.Fprintf(&b, "✓ %s: %s\n", o.Host, v.Finding)
default:
badN++
fmt.Fprintf(&b, "× %s: %s\n", o.Host, v.Finding)
}
}
b.WriteString("\n" + i18n.T("Prüfbefehle (nur lesend):") + "\n")
for _, c := range m.cmds {
b.WriteString(" $ " + c + "\n")
}
text = strings.TrimRight(b.String(), "\n")
if len(text) > 6000 {
text = text[:6000] + "\n…"
}
return text, okN, badN
}
func (a *App) schedAIMsg(msg tea.Msg) (tea.Cmd, bool) {
m, ok := msg.(schedAIMsg)
if !ok {
return nil, false
}
if m.err != nil {
return a.scheduleMsg(schedDoneMsg{id: m.id, err: m.err})
}
delete(a.schedRun, m.id)
text, okN, badN := schedAIReport(m)
a.updateSchedule(m.id, func(x *domain.Schedule) { x.LastOK, x.LastFail, x.LastText = okN, badN, text })
name := i18n.T("KI-Prüfung")
if sc, ok := a.scheduleByID(m.id); ok {
name = sc.Name
}
head := fmt.Sprintf(i18n.T("Zeitplan „%s“: KI-Prüfung fertig, %d in Ordnung, %d mit Befund"), name, okN, badN)
body := orDefault(m.sum, fmt.Sprintf(i18n.T("%d in Ordnung, %d mit Befund"), okN, badN))
if badN > 0 {
a.pushToast(toastWarn, head+"\n"+trunc(body, 200))
} else {
a.flashOK(head)
}
a.schedDesktop(name, body)
if a.pick != nil && a.pick.title == i18n.T("Zeitpläne") {
a.pick.items = a.scheduleItems()
}
return nil, true
}
+32 -3
View File
@@ -227,7 +227,7 @@ func (a *App) openScheduleForm(sc domain.Schedule) tea.Cmd {
}
f := &form{title: title}
f.text("name", "Name", sc.Name, i18n.T("z. B. „Switch-Configs sichern“"))
kinds := []string{i18n.T("Befehle oder Runbook"), i18n.T("Config-Sicherung (Switches)"), i18n.T("Ordner-Scan (Logs)"), i18n.T("Sicherheitscheck (OSV)")}
kinds := []string{i18n.T("Befehle oder Runbook"), i18n.T("Config-Sicherung (Switches)"), i18n.T("Ordner-Scan (Logs)"), i18n.T("Sicherheitscheck (OSV)"), i18n.T("KI-Prüfung (nur lesend)")}
kindCur := kinds[0]
switch sc.Kind {
case domain.ScheduleBackup:
@@ -236,9 +236,14 @@ func (a *App) openScheduleForm(sc domain.Schedule) tea.Cmd {
kindCur = kinds[2]
case domain.ScheduleVuln:
kindCur = kinds[3]
case domain.ScheduleAI:
kindCur = kinds[4]
}
f.choice("kind", i18n.T("Art"), kinds, kindCur, i18n.T("Config-Sicherung: show running-config je Switch, verschlüsselt gespeichert · Ordner-Scan: Log-Blick je Host, Ergebnis mit neuen Mustern · Sicherheitscheck: Pakete je Server gegen OSV, meldet neu betroffene"))
isBackup := func(f *form) bool { return f.sel("kind") != kinds[0] }
f.text("prompt", i18n.T("Prüfauftrag"), sc.Prompt, i18n.T("in eigenen Worten · die KI wählt Befehle, die nur lesen, und meldet je Server, was auffällt")).hidden = func(f *form) bool {
return f.sel("kind") != kinds[4]
}
f.text("at", i18n.T("Uhrzeit"), sc.At, i18n.T("HH:MM, Ortszeit dieses Rechners"))
var days []string
for _, d := range dayChoices {
@@ -354,9 +359,15 @@ func (a *App) saveScheduleForm() error {
sc.Kind = domain.ScheduleLogs
case i18n.T("Sicherheitscheck (OSV)"):
sc.Kind = domain.ScheduleVuln
case i18n.T("KI-Prüfung (nur lesend)"):
sc.Kind = domain.ScheduleAI
}
sc.Prompt = ""
if sc.Kind == domain.ScheduleAI {
sc.Prompt = strings.TrimSpace(f.str("prompt"))
}
sc.RunbookID, sc.Steps = a.schedRBIDs[f.sel("runbook")], nil
if sc.Kind == domain.ScheduleBackup || sc.Kind == domain.ScheduleLogs || sc.Kind == domain.ScheduleVuln {
if sc.Kind == domain.ScheduleBackup || sc.Kind == domain.ScheduleLogs || sc.Kind == domain.ScheduleVuln || sc.Kind == domain.ScheduleAI {
sc.RunbookID = ""
} else if sc.RunbookID == "" {
for _, st := range strings.Split(f.str("steps"), schedStepSep) {
@@ -374,6 +385,9 @@ func (a *App) saveScheduleForm() error {
if sc.Name == "" && sc.Kind == domain.ScheduleVuln {
sc.Name = i18n.T("Sicherheitscheck (OSV)")
}
if sc.Name == "" && sc.Kind == domain.ScheduleAI {
sc.Name = trunc(sc.Prompt, 40)
}
if sc.Name == "" {
sc.Name = orDefault(firstOf(sc.Steps), i18n.T("Zeitplan"))
}
@@ -381,6 +395,9 @@ func (a *App) saveScheduleForm() error {
if sc.Kind == domain.ScheduleBackup {
return errors.New(i18n.T("Kein Switch im Ziel (Server werden bei der Config-Sicherung übersprungen)"))
}
if sc.Kind == domain.ScheduleAI {
return errors.New(i18n.T("Kein Linux- oder Unix-Server im Ziel (die KI-Prüfung läuft nicht auf Switches und Windows)"))
}
return errors.New(i18n.T("Kein Ziel: Ordner wählen oder Verbindungen eintragen"))
}
if _, err := a.schedSteps(sc); err != nil {
@@ -503,6 +520,9 @@ func (a *App) schedConns(sc domain.Schedule) []domain.Connection {
if c.Protocol.Raw() {
continue
}
if sc.Kind == domain.ScheduleAI && (isNetConn(c) || (c.Profile != nil && c.Profile.Family == domain.FamilyWindows)) {
continue // ein Satz Befehle für alle: nur Unix-Server
}
if sc.Kind == domain.ScheduleBackup && !maybeNetConn(c) {
continue
}
@@ -533,6 +553,12 @@ func (a *App) schedSteps(sc domain.Schedule) ([]string, error) {
if sc.Kind == domain.ScheduleVuln {
return []string{"osv-scan"}, nil
}
if sc.Kind == domain.ScheduleAI {
if strings.TrimSpace(sc.Prompt) == "" {
return nil, errors.New(i18n.T("Prüfauftrag fehlt: in eigenen Worten, was die KI prüfen soll"))
}
return []string{"ai-check"}, nil
}
steps := sc.Steps
if sc.RunbookID != "" {
var found bool
@@ -635,6 +661,9 @@ func (a *App) startSchedule(sc domain.Schedule) tea.Cmd {
if sc.Kind == domain.ScheduleVuln {
return a.startScheduleVuln(sc, conns)
}
if sc.Kind == domain.ScheduleAI {
return a.startScheduleAI(sc, conns)
}
job := broadcast.Job{Conns: conns, Steps: steps}
if sc.Kind == "" && !stepsReadOnly(steps) {
job.Canary, job.StopAfter = true, bcStopAfter // ohne Aufsicht erst recht
@@ -745,7 +774,7 @@ func (a *App) scheduleMsg(msg tea.Msg) (tea.Cmd, bool) {
}
func (a *App) schedDesktop(name, body string) {
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() && a.notifyOn() {
if a.notifyAway() && a.notifyOn() {
if a.lock != nil {
body = i18n.T("Zeitplan ist gelaufen")
}
+3
View File
@@ -42,6 +42,8 @@ const (
// session ist eine offene SSH-Sitzung (ein Tab).
type session struct {
oldOut string // Ausgabe vom letzten Mal, kommt beim Verbinden vor die neue (closedtabs.go)
oldLog string // Protokoll, aus dem oldOut stammt (für die nächste Sicherung)
connNote string // Hinweis während des Verbindens (z. B. Sicherheitsschlüssel berühren)
connStep int // Schritt beim Verbinden (sshx.Step…), Karte in motion2.go
connStepAt [4]time.Time // Beginn jedes Schritts
@@ -298,6 +300,7 @@ func (a *App) connectCmd(s *session) tea.Cmd {
if !keepTerm {
s.term = termemu.New(cols, rows, shellWriter{s})
s.pixelImages() // pixelgenaue Bilder, wenn das Terminal es kann (pixels.go)
s.seedOld() // Ausgabe vom letzten Mal (closedtabs.go)
}
sh, err := c.OpenShell(cols, rows, outWriter{s, ev})
if err != nil {
+6 -1
View File
@@ -901,10 +901,15 @@ func (a *App) paneTitle(s *session, w int, focused, grip bool) string {
}
marks = append(marks, i18n.F("■ Zoom · %d weitere verdeckt · %s zurück", n, a.keys.label(actZoom)))
}
if focused && len(marks) == 0 && w >= 60 {
// Statuszeile je Bereich (panestatus.go): Ordner, letzter Befehl, Last
stat := a.paneStatus(s, time.Now())
if focused && len(marks) == 0 && w >= 60 && stat == "" {
marks = append(marks, i18n.T("Strg+Pfeil wechselt"))
}
right := strings.Join(marks, " · ")
if stat != "" && ansi.StringWidth(left)+ansi.StringWidth(stat)+ansi.StringWidth(right)+6 < w-gw {
right = strings.TrimSuffix(stat+" · "+right, " · ") // nur, wenn Name und Adresse noch passen
}
if right != "" {
right += " "
}
+1 -1
View File
@@ -43,7 +43,7 @@ func (a *App) syncTargets(s *session) []*session {
var out []*session
for _, id := range a.panes {
x := a.byID(id)
if x == nil || x == s || x.term == nil || x.state != stConnected || x.detached() || x.panelFocus || x.files.open {
if x == nil || x == s || x.term == nil || x.state != stConnected || x.detached() || x.panelFocus || x.filesFocus() {
continue
}
out = append(out, x)
+1
View File
@@ -211,6 +211,7 @@ func (a *App) tabMenu(s *session, x, y int, after func()) *modal {
group(menuItem{label: i18n.T("Nach rechts"), run: func() tea.Cmd { a.moveTab(s, 1); return nil }})
}
items = append(items, menuItem{label: i18n.T("Tab schließen"), hint: k.label(actCloseTab), sep: true, run: func() tea.Cmd { return a.closeTabAsk(s, after) }})
items = append(items, menuItem{label: i18n.T("Zuletzt geschlossen …"), run: func() tea.Cmd { return a.openClosed() }})
if len(a.sessions) > 1 {
items = append(items, menuItem{label: i18n.T("Andere Tabs schließen"), run: func() tea.Cmd { return a.closeOtherTabs(s) }})
}
+505
View File
@@ -0,0 +1,505 @@
package ui
// Aufgaben je Verbindung oder Ordner (domain/tasks.go): offene Arbeiten
// mit Fälligkeit. u im Manager (oder Alt+A im Terminal) zeigt die Liste der
// gewählten Verbindung samt den Aufgaben ihrer Ordner. ⏎ startet eine
// Aufgabe als Ziel im offenen Tab dieser Verbindung (Ziel- oder
// Agent-Modus, wie zuletzt gewählt); danach steht sie „zur Abnahme“ mit
// dem Ergebnis und der Gegenprüfung, a hakt sie ab.
import (
"fmt"
"sort"
"strings"
"time"
tea "charm.land/bubbletea/v2"
"charm.land/lipgloss/v2"
"github.com/charmbracelet/x/ansi"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/i18n"
)
const mTasks modalKind = 100 // Aufgabenliste (eigene Nummer, kein iota-Konflikt)
// taskRef: eine Aufgabe in der Liste; folder != "" = Aufgabe des Ordners.
type taskRef struct {
folder string
t domain.Task
}
type taskList struct {
connID string // "" = nur ein Ordner
folder string // Ordner der Liste (bei Verbindung: ihr Ordner)
sel int
}
// openTasks: Liste für eine Verbindung (mit ihren Ordnern) oder einen Ordner.
func (a *App) openTasks(connID, folder string) tea.Cmd {
a.taskL = &taskList{connID: connID, folder: domain.NormPath(folder)}
a.modal = &modal{kind: mTasks}
return nil
}
// taskRefs: offene zuerst (zur Abnahme, läuft, offen; nach Fälligkeit),
// dann die zuletzt erledigten.
func (a *App) taskRefs() []taskRef {
l := a.taskL
if l == nil {
return nil
}
var out []taskRef
if l.connID != "" {
if c, ok := a.st.Connection(l.connID); ok {
for _, t := range c.Tasks {
out = append(out, taskRef{t: t})
}
}
}
for p := l.folder; p != ""; p = domain.PathParent(p) {
for _, t := range a.st.FolderTasks(p) {
out = append(out, taskRef{folder: p, t: t})
}
if l.connID == "" {
break // Ordnerliste: nur dieser Ordner
}
}
rank := func(s string) int {
switch s {
case domain.TaskReview:
return 0
case domain.TaskRunning:
return 1
case domain.TaskOpen:
return 2
}
return 3
}
sort.SliceStable(out, func(i, j int) bool {
a, b := out[i].t, out[j].t
if rank(a.State) != rank(b.State) {
return rank(a.State) < rank(b.State)
}
if a.State == domain.TaskDone {
return a.Updated.After(b.Updated)
}
if a.Due.IsZero() != b.Due.IsZero() {
return !a.Due.IsZero()
}
if !a.Due.Equal(b.Due) {
return a.Due.Before(b.Due)
}
return a.Created.Before(b.Created)
})
// erledigte: nur die letzten fünf zeigen
n := 0
keep := out[:0]
for _, r := range out {
if r.t.State == domain.TaskDone {
n++
if n > 5 {
continue
}
}
keep = append(keep, r)
}
return keep
}
// updateTask ändert eine Aufgabe (Verbindung oder Ordner) per ID.
func (a *App) updateTask(connID, folder, id string, fn func(t *domain.Task) bool) error {
edit := func(ts []domain.Task) ([]domain.Task, bool) {
out := append([]domain.Task(nil), ts...)
for i := range out {
if out[i].ID == id {
if !fn(&out[i]) { // false = löschen
return append(out[:i], out[i+1:]...), true
}
out[i].Updated = time.Now().UTC()
return out, true
}
}
return out, false
}
if folder != "" {
ts, ok := edit(a.st.FolderTasks(folder))
if !ok {
return nil
}
return a.st.SetFolderTasks(folder, ts)
}
c, ok := a.st.Connection(connID)
if !ok {
return fmt.Errorf("%s", i18n.T("Verbindung nicht gefunden"))
}
ts, found := edit(c.Tasks)
if !found {
return nil
}
c.Tasks = ts
_, err := a.st.UpsertConnection(c)
return err
}
func (a *App) addTask(connID, folder, text string) error {
text, due := domain.ParseTaskText(text, time.Now())
if strings.TrimSpace(text) == "" {
return nil
}
t := domain.Task{ID: "t" + strconvBase36(time.Now().UnixNano()), Text: text, Due: due, Created: time.Now().UTC()}
if folder != "" && connID == "" {
return a.st.SetFolderTasks(folder, append(a.st.FolderTasks(folder), t))
}
c, ok := a.st.Connection(connID)
if !ok {
return fmt.Errorf("%s", i18n.T("Verbindung nicht gefunden"))
}
c.Tasks = append(append([]domain.Task(nil), c.Tasks...), t)
_, err := a.st.UpsertConnection(c)
return err
}
func strconvBase36(n int64) string {
const digits = "0123456789abcdefghijklmnopqrstuvwxyz"
if n < 0 {
n = -n
}
var b []byte
for n > 0 {
b = append([]byte{digits[n%36]}, b...)
n /= 36
}
return string(b)
}
// taskSession: offener, verbundener Tab für die Aufgabe.
func (a *App) taskSession(r taskRef) *session {
l := a.taskL
ok := func(s *session) bool {
if s == nil || s.state != stConnected || s.term == nil {
return false
}
if l.connID != "" {
return s.conn.ID == l.connID
}
g := domain.NormPath(s.conn.Group)
return g == r.folder || strings.HasPrefix(g, r.folder+domain.PathSep)
}
if s := a.current(); ok(s) {
return s
}
for _, s := range a.sessions {
if ok(s) {
return s
}
}
return nil
}
// startTask: Aufgabe als Ziel im passenden Tab.
func (a *App) startTask(r taskRef) tea.Cmd {
if r.t.State == domain.TaskDone {
a.flash(i18n.T("Schon erledigt · a öffnet sie wieder"))
return nil
}
s := a.taskSession(r)
if s == nil {
if a.taskL.connID != "" {
if c, ok := a.st.Connection(a.taskL.connID); ok {
a.flash(fmt.Sprintf(i18n.T("Erst mit %s verbinden, dann ⏎ in den Aufgaben (Alt+A)"), c.Alias))
return nil
}
}
a.flash(i18n.T("Kein offener Tab zu dieser Aufgabe: erst verbinden"))
return nil
}
connID, folder, id := a.taskL.connID, r.folder, r.t.ID
if folder == "" {
connID = s.conn.ID
}
_ = a.updateTask(connID, folder, id, func(t *domain.Task) bool { t.State, t.Note = domain.TaskRunning, ""; return true })
a.modal, a.taskL = nil, nil
for i, x := range a.sessions {
if x == s {
a.focusSession(i)
}
}
a.scr = scrTerminal
cmd := a.startGoal(s, r.t.Text)
s.goal.task = &goalTask{connID: connID, folder: folder, id: id}
return cmd
}
// goalTask: das laufende Ziel gehört zu dieser Aufgabe.
type goalTask struct{ connID, folder, id string }
// taskGoalEnded (aus recordGoal): Aufgabe zur Abnahme bzw. wieder offen.
func (a *App) taskGoalEnded(s *session, state string) {
gt := s.goal.task
if gt == nil {
return
}
if state != "done" {
s.goal.task = nil
}
note := s.goal.doneReason
_ = a.updateTask(gt.connID, gt.folder, gt.id, func(t *domain.Task) bool {
if state == "done" {
t.State, t.Note = domain.TaskReview, note
} else {
t.State, t.Note = domain.TaskOpen, i18n.T("Ziel abgebrochen")
}
return true
})
}
// taskVerified (aus verifyDone): Befund der Gegenprüfung an die Aufgabe.
func (a *App) taskVerified(s *session, ok bool, finding string) {
gt := s.goal.task
if gt == nil {
return
}
s.goal.task = nil
mark := "✓ "
if !ok {
mark = "▲ "
}
_ = a.updateTask(gt.connID, gt.folder, gt.id, func(t *domain.Task) bool {
t.Note = strings.TrimSpace(t.Note + "\n" + mark + i18n.T("Gegenprüfung: ") + finding)
return true
})
}
func (a *App) tasksKey(key string) tea.Cmd {
l := a.taskL
refs := a.taskRefs()
if l == nil {
a.modal = nil
return nil
}
l.sel = clamp(l.sel, 0, max(0, len(refs)-1))
var cur *taskRef
if l.sel < len(refs) {
cur = &refs[l.sel]
}
target := func(r *taskRef) string { // Verbindung der Aufgabe
if r.folder != "" {
return ""
}
return l.connID
}
switch key {
case "esc", "q":
a.modal, a.taskL = nil, nil
case "up", "k":
l.sel = max(0, l.sel-1)
case "down", "j":
l.sel = min(max(0, len(refs)-1), l.sel+1)
case "n", "N":
connID, folder := l.connID, ""
where := i18n.T("dieser Verbindung")
if key == "N" || l.connID == "" {
if l.folder == "" {
a.flash(i18n.T("Die Verbindung liegt in keinem Ordner"))
return nil
}
connID, folder = "", l.folder
where = i18n.T("dem Ordner ") + l.folder
}
back := *l
a.modal = inputModal(i18n.T("Neue Aufgabe"), i18n.T("Für ")+where+i18n.T(". Fälligkeit am Ende, z. B. „bis 12.12.“"), "", func(x string) tea.Cmd {
if err := a.addTask(connID, folder, x); err != nil {
a.flashErr(err.Error())
}
a.taskL = &back
a.modal = &modal{kind: mTasks}
return nil
})
a.modal.in.Placeholder = i18n.T("z. B. Zertifikat erneuern bis 12.12.")
a.modal.in.SetWidth(60)
case "enter":
if cur != nil {
return a.startTask(*cur)
}
case "a", "space":
if cur == nil {
return nil
}
_ = a.updateTask(target(cur), cur.folder, cur.t.ID, func(t *domain.Task) bool {
if t.State == domain.TaskDone {
t.State = domain.TaskOpen
} else {
t.State = domain.TaskDone
}
return true
})
case "e":
if cur == nil {
return nil
}
r, back := *cur, *l
val := r.t.Text
if !r.t.Due.IsZero() {
val += " " + r.t.Due.Format("02.01.2006")
}
a.modal = inputModal(i18n.T("Aufgabe ändern"), i18n.T("Fälligkeit am Ende, z. B. „bis 12.12.“"), val, func(x string) tea.Cmd {
text, due := domain.ParseTaskText(x, time.Now())
if text != "" {
_ = a.updateTask(target(&r), r.folder, r.t.ID, func(t *domain.Task) bool { t.Text, t.Due = text, due; return true })
}
a.taskL = &back
a.modal = &modal{kind: mTasks}
return nil
})
a.modal.in.SetWidth(60)
case "delete", "d", "backspace":
if cur == nil {
return nil
}
r := *cur
_ = a.updateTask(target(&r), r.folder, r.t.ID, func(*domain.Task) bool { return false })
a.flash(i18n.T("Aufgabe gelöscht: ") + trunc(r.t.Text, 40))
}
return nil
}
func (a *App) tasksView() string {
st := a.s
l := a.taskL
refs := a.taskRefs()
w := dialogInner(a.w)
title, sub := i18n.T("Aufgaben"), l.folder
if l.connID != "" {
if c, ok := a.st.Connection(l.connID); ok {
sub = c.Alias
}
}
now := time.Now()
var b strings.Builder
if len(refs) == 0 {
b.WriteString(st.Muted.Render(i18n.T("Noch keine Aufgaben. n legt eine an, z. B. „Zertifikat erneuern bis 12.12.“.")) + "\n")
}
for i, r := range refs {
t := r.t
mark, ms := "○", st.Text
switch t.State {
case domain.TaskRunning:
mark, ms = "◌", st.AI
case domain.TaskReview:
mark, ms = "◆", st.Warn
case domain.TaskDone:
mark, ms = "✓", st.Muted
}
meta := ""
switch {
case t.State == domain.TaskReview:
meta = i18n.T("zur Abnahme")
case t.State == domain.TaskRunning:
meta = i18n.T("läuft")
case t.Overdue(now):
meta = i18n.T("fällig ") + t.Due.Format("02.01.")
case !t.Due.IsZero():
meta = i18n.T("bis ") + t.Due.Format("02.01.")
}
if r.folder != "" && l.connID != "" {
meta = strings.TrimSpace(meta + " · " + trunc(r.folder, 18))
}
text := trunc(t.Text, max(10, w-lipgloss.Width(meta)-6))
line := ms.Render(mark) + " " + st.Text.Render(text)
if t.State == domain.TaskDone {
line = ms.Render(mark + " " + text)
}
gap := max(1, w-2-lipgloss.Width(mark+" "+text)-lipgloss.Width(meta))
metaSt := st.Muted
if t.Overdue(now) || t.State == domain.TaskReview {
metaSt = st.Warn
}
line += strings.Repeat(" ", gap) + metaSt.Render(meta)
if i == l.sel {
line = st.Selected.Render(ansi.Strip(line))
}
b.WriteString(line + "\n")
if i == l.sel && t.Note != "" {
for _, nl := range strings.Split(t.Note, "\n") {
for _, wl := range wrapText(nl, max(20, w-6)) {
b.WriteString(" " + st.Muted.Render(wl) + "\n")
}
}
}
}
keys := [][2]string{{"⏎", i18n.T("als Ziel starten")}, {"n", i18n.T("neu")}}
if l.connID != "" && l.folder != "" {
keys = append(keys, [2]string{"⇧N", i18n.T("neu für den Ordner")})
}
keys = append(keys, [2]string{"a", i18n.T("abhaken")}, [2]string{"e", i18n.T("ändern")}, [2]string{"Entf", i18n.T("löschen")}, [2]string{"Esc", i18n.T("schließen")})
return st.dialog(dialog{icon: "◇", title: title, sub: sub, body: b.String(), keys: keys, width: w}, a.w)
}
// tasksBadge: „2 Aufgaben · 1 fällig“ für die Detailspalte ("" = keine).
func tasksBadge(ts []domain.Task, now time.Time) string {
n, due, review := 0, 0, 0
for _, t := range ts {
if t.State == domain.TaskDone {
continue
}
n++
if t.Overdue(now) {
due++
}
if t.State == domain.TaskReview {
review++
}
}
if n == 0 {
return ""
}
out := plural(n, i18n.T("Aufgabe"), i18n.T("Aufgaben"))
if due > 0 {
out += fmt.Sprintf(i18n.T(" · %d fällig"), due)
}
if review > 0 {
out += fmt.Sprintf(i18n.T(" · %d zur Abnahme"), review)
}
return out + i18n.T(" · u zeigt")
}
// folderTasksUp: Aufgaben aller Ordner über einer Verbindung.
func (a *App) folderTasksUp(group string) []domain.Task {
var out []domain.Task
for p := domain.NormPath(group); p != ""; p = domain.PathParent(p) {
out = append(out, a.st.FolderTasks(p)...)
}
return out
}
// tasksReminder: einmal nach dem Entsperren an fällige Aufgaben erinnern.
func (a *App) tasksReminder(now time.Time) {
if a.tasksReminded || a.st == nil || a.scr == scrUnlock || a.st.V == nil || !a.st.V.Unlocked() {
return
}
a.tasksReminded = true
due, review := 0, 0
count := func(ts []domain.Task) {
for _, t := range ts {
if t.Overdue(now) {
due++
}
if t.State == domain.TaskReview {
review++
}
}
}
for _, c := range a.st.Connections() {
count(c.Tasks)
}
for _, f := range a.st.Folders() {
count(f.Tasks)
}
switch {
case due > 0:
a.pushToast(toastWarn, fmt.Sprintf(i18n.T("%s fällig · u im Manager zeigt die Aufgaben"), plural(due, i18n.T("Aufgabe"), i18n.T("Aufgaben"))))
case review > 0:
a.flash(fmt.Sprintf(i18n.T("%s zur Abnahme · u im Manager"), plural(review, i18n.T("Aufgabe"), i18n.T("Aufgaben"))))
}
}
+136
View File
@@ -0,0 +1,136 @@
package ui
import (
"strings"
"testing"
"time"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/agent"
"github.com/db9979/sshtermy/internal/domain"
)
func TestGoalDiffText(t *testing.T) {
a := dangerApp(t)
s := &session{conn: domain.Connection{Alias: "web"}}
list := []fileBackup{
{Path: "/etc/nginx/nginx.conf", Existed: true, Content: []byte("a\nb\nc\n")},
{Path: "/etc/new.conf"},
{Path: "/etc/same", Existed: true, Content: []byte("x\n")},
{Path: "/etc/secret", Existed: true, Content: []byte("x")},
}
now := []fileNow{
{Path: "/etc/nginx/nginx.conf", Exists: true, Content: []byte("a\nB\nc\nd\n")},
{Path: "/etc/new.conf", Exists: true, Content: []byte("neu\n")},
{Path: "/etc/same", Exists: true, Content: []byte("x\n")},
{Path: "/etc/secret", Err: "nicht lesbar"},
}
title, lines := a.goalDiffText(s, list, now)
body := ansiStrip(strings.Join(lines, "\n"))
for _, want := range []string{"+ B", "- b", "+ d", "neu angelegt", "unverändert", "nicht lesbar"} {
if !strings.Contains(body, want) {
t.Errorf("%q fehlt:\n%s", want, body)
}
}
if tt := ansiStrip(title); !strings.Contains(tt, "2 Dateien") || !strings.Contains(tt, "+3") || !strings.Contains(tt, "−1") {
t.Errorf("Titel: %q", tt)
}
}
func TestViewVerify(t *testing.T) {
a := dangerApp(t)
s := &session{conn: domain.Connection{Alias: "web"}}
s.goal.done = true
var b strings.Builder
s.goal.verify = &verifyState{busy: true, model: "m"}
a.viewVerify(&b, s, 60)
if !strings.Contains(ansiStrip(b.String()), "läuft") {
t.Error(b.String())
}
b.Reset()
s.goal.verify = &verifyState{v: agent.Verdict{OK: false, Finding: "Port 443 zu"}, checks: []string{"ss -ltn"}}
a.viewVerify(&b, s, 60)
if v := ansiStrip(b.String()); !strings.Contains(v, "Zweifel") || !strings.Contains(v, "Port 443 zu") || !strings.Contains(v, "ss -ltn") {
t.Error(v)
}
_ = a.toggleVerify()
if a.verifyOn() {
t.Error("Schalter")
}
}
func TestTasksFlow(t *testing.T) {
a := dangerApp(t)
c, err := a.st.UpsertConnection(domain.Connection{Alias: "web", Host: "web.lan", Username: "root", Group: "Prod / Web"})
if err != nil {
t.Fatal(err)
}
if err := a.addTask(c.ID, "", "Zertifikat erneuern bis 1.1.2020"); err != nil {
t.Fatal(err)
}
if err := a.addTask("", "Prod", "Kernel-Updates einspielen"); err != nil {
t.Fatal(err)
}
_ = a.openTasks(c.ID, c.Group)
refs := a.taskRefs()
if len(refs) != 2 || refs[0].t.Text != "Zertifikat erneuern" || refs[1].folder != "Prod" {
t.Fatalf("Liste: %+v", refs)
}
v := ansiStrip(a.tasksView())
if !strings.Contains(v, "fällig 01.01.") || !strings.Contains(v, "Prod") {
t.Errorf("Ansicht:\n%s", v)
}
if b := tasksBadge(append(c.Tasks, refs[0].t), time.Now()); !strings.Contains(b, "fällig") {
t.Errorf("Badge %q", b)
}
// ohne offenen Tab: nichts starten
if cmd := a.tasksKey("enter"); cmd != nil || a.modal == nil {
t.Error("ohne Tab gestartet")
}
// mit Tab: Ziel startet, Aufgabe läuft
s, _ := typedSession(c, "root@web:~# ", "")
a.sessions = []*session{s}
a.cur = 0
_ = a.tasksKey("enter")
if !s.goal.active || s.goal.goal != "Zertifikat erneuern" || s.goal.task == nil {
t.Fatalf("Ziel nicht gestartet: %+v", s.goal.goal)
}
got, _ := a.st.Connection(c.ID)
if got.Tasks[0].State != domain.TaskRunning {
t.Errorf("Zustand %q", got.Tasks[0].State)
}
// Ziel erreicht → zur Abnahme, Gegenprüfung hängt den Befund an
s.goal.doneReason = "neues Zertifikat bis 2027"
a.taskGoalEnded(s, "done")
a.taskVerified(s, true, "Ablaufdatum 2027 belegt")
got, _ = a.st.Connection(c.ID)
if got.Tasks[0].State != domain.TaskReview || !strings.Contains(got.Tasks[0].Note, "Ablaufdatum 2027") {
t.Errorf("nach dem Ziel: %+v", got.Tasks[0])
}
// abhaken, löschen
_ = a.openTasks(c.ID, c.Group)
_ = a.tasksKey("a")
got, _ = a.st.Connection(c.ID)
if got.Tasks[0].State != domain.TaskDone {
t.Error("nicht abgehakt")
}
a.taskL.sel = 0
refs = a.taskRefs()
for i, r := range refs {
if r.folder == "Prod" {
a.taskL.sel = i
}
}
_ = a.tasksKey("delete")
if len(a.st.FolderTasks("Prod")) != 0 {
t.Error("Ordner-Aufgabe nicht gelöscht")
}
_ = a.tasksKey("esc")
if a.modal != nil {
t.Error("Esc schließt")
}
// u im Manager
a.scr = scrManager
_, _ = a.Update(tea.KeyPressMsg{Code: 'u', Text: "u"})
}
+130
View File
@@ -0,0 +1,130 @@
package ui
import (
"context"
"os/exec"
"strings"
"testing"
"time"
"github.com/db9979/sshtermy/internal/agent"
"github.com/db9979/sshtermy/internal/domain"
"github.com/db9979/sshtermy/internal/push"
"github.com/db9979/sshtermy/internal/sessionlog"
"github.com/db9979/sshtermy/internal/termemu"
)
func TestOldOutputAndClosedTabs(t *testing.T) {
a := dangerApp(t)
c, err := a.st.UpsertConnection(domain.Connection{Alias: "web", Host: "web.lan", Username: "root"})
if err != nil {
t.Fatal(err)
}
s, _ := typedSession(c, "root@web:~# ", "")
a.sessions = []*session{s}
a.startLog(s)
s.log.Add(sessionlog.Entry{At: time.Now(), Command: "uptime", Output: "\x1b[31m 21:03 up 4 days\x1b[0m\n"})
a.saveLog(s)
id := s.log.ID
a.closeTab(s)
if len(a.sessions) != 0 || len(a.closed) != 1 || a.closed[0].LogID != id {
t.Fatalf("nicht gemerkt: %+v", a.closed)
}
// nach einem Neustart aus der Datei
a.closed, a.closedLoaded = nil, false
a.loadClosed()
if len(a.closed) != 1 {
t.Fatal("Datei nicht gelesen")
}
_ = a.openClosed()
if a.modal == nil || a.modal.kind != mMenu || a.modal.items[0].label != "web" {
t.Fatalf("Menü: %+v", a.modal)
}
a.modal = nil
if a.reopenClosed(0) == nil || len(a.sessions) != 1 || len(a.closed) != 0 {
t.Fatal("nicht wieder geöffnet")
}
n := a.sessions[0]
if !strings.Contains(n.oldOut, "uptime") || strings.Contains(n.oldOut, "[31m") || n.oldLog != id {
t.Fatalf("alte Ausgabe: %q", n.oldOut)
}
n.term = termemu.New(80, 10, discard{})
n.seedOld()
txt := n.term.ScreenText()
if !strings.Contains(txt, "21:03 up 4 days") || !strings.Contains(txt, "Ausgabe vom letzten Mal") {
t.Fatalf("Bildschirm:\n%s", txt)
}
// ohne neuen Befehl zeigt die nächste Sicherung weiter aufs alte Protokoll
if a.tabRef(n).LogID != id {
t.Error("LogID verloren")
}
}
func TestSchedAILine(t *testing.T) {
cmds := []string{"echo eins", "false", "printf 'a\\nb'"}
out, _ := exec.Command("sh", "-c", schedAILine(cmds)).CombinedOutput()
res := schedAISplit(string(out), cmds)
if res[0].Output != "eins" || res[0].Exit != 0 || res[1].Exit != 1 || res[2].Output != "a\nb" {
t.Fatalf("%+v\n%s", res, out)
}
text, okN, badN := schedAIReport(schedAIMsg{cmds: cmds, sum: "web2 voll",
outs: []agent.HostOutput{{Host: "web1"}, {Host: "web2"}, {Host: "web3", Err: "Zeitüberschreitung"}},
verdicts: []agent.HostVerdict{{Host: "web1", OK: true, Finding: "gut"}, {Host: "web2", Finding: "97 %"}}})
if okN != 1 || badN != 2 || !strings.Contains(text, "× web2: 97 %") || !strings.Contains(text, "$ false") {
t.Fatalf("%d %d\n%s", okN, badN, text)
}
}
func TestScheduleFormAI(t *testing.T) {
a := dangerApp(t)
if _, err := a.st.UpsertConnection(domain.Connection{Alias: "web", Host: "web.lan", Username: "root", Group: "Prod"}); err != nil {
t.Fatal(err)
}
if _, err := a.st.UpsertConnection(domain.Connection{Alias: "sw", Host: "sw.lan", Username: "admin", Group: "Prod", Device: domain.DeviceNetwork}); err != nil {
t.Fatal(err)
}
sc := domain.Schedule{Kind: domain.ScheduleAI, Folder: "Prod"}
if _, err := a.schedSteps(sc); err == nil {
t.Error("ohne Prüfauftrag gespeichert")
}
sc.Prompt = "läuft nginx?"
if c := a.schedConns(sc); len(c) != 1 || c[0].Alias != "web" {
t.Errorf("Ziele: %+v", c)
}
}
func TestPushWhenAway(t *testing.T) {
a := dangerApp(t)
got := make(chan push.Message, 4)
old, oldD := pushSendFn, desktopSend
pushSendFn = func(_ context.Context, c push.Config, m push.Message) error {
if c.Kind != push.Ntfy {
t.Errorf("Art %q", c.Kind)
}
got <- m
return nil
}
desktopSend = func(string, string, func()) {}
defer func() { pushSendFn, desktopSend = old, oldD }()
s, _ := typedSession(domain.Connection{Alias: "web"}, "", "")
a.sessions = []*session{s}
a.sendDesktopFor(s, "sshTermy · web", "make fertig")
if a.notifyAway() || len(got) != 0 {
t.Fatal("ohne Einrichtung oder am Rechner nichts schicken")
}
_ = a.st.UpdateSettings(func(x *domain.Settings) {
x.Push = domain.PushConfig{Kind: push.Ntfy, URL: "https://ntfy.example/thema"}
})
a.lastKey = time.Now().Add(-pushIdle - time.Second) // lange keine Taste
a.noticeDone(s, "export PASSWORD=geheim; make", 2*notifyAfter, true, false)
select {
case m := <-got:
if strings.Contains(m.Body, "geheim") || !m.Urgent || !strings.Contains(m.Body, "make") {
t.Errorf("%+v", m)
}
case <-time.After(2 * time.Second):
t.Fatal("keine Handy-Meldung")
}
}
+132
View File
@@ -0,0 +1,132 @@
package ui
import (
"strings"
"testing"
"time"
tea "charm.land/bubbletea/v2"
"github.com/db9979/sshtermy/internal/domain"
)
func dockApp(t *testing.T) (*App, *session) {
t.Helper()
a := dangerApp(t)
a.w, a.h = 160, 50
s, _ := typedSession(domain.Connection{Alias: "web"}, "$ ", "")
a.sessions, a.cur = []*session{s}, 0
s.panel = panelTunnels
return a, s
}
func TestPanelDock(t *testing.T) {
a, s := dockApp(t)
r := a.termRect(s)
if b := a.termBox(s); b.x != r.x || b.w != r.w-a.panelWidth(s) {
t.Fatalf("rechts: %+v in %+v", b, r)
}
_ = a.cycleDock(1) // links
if a.panelDock(s) != dockLeft {
t.Fatal(a.panelDock(s))
}
pw := a.panelWidth(s)
if b := a.termBox(s); b.x != r.x+pw || !a.inPanel(s, r.x+1, r.y+2) || a.inTermArea(s, r.x+1, r.y+2) || !a.inTermArea(s, r.x+pw+1, r.y+2) {
t.Fatalf("links: %+v", b)
}
body, _ := a.paneBody(s, true)
if first := strings.Split(ansiStrip(body), "\n")[0]; !strings.HasPrefix(first, "╭") && !strings.HasPrefix(first, "┌") {
t.Errorf("Panel nicht links: %q", first)
}
_ = a.cycleDock(1) // unten
ph := a.panelHeight(s)
if b := a.termBox(s); b.w != r.w || b.h != r.h-ph || a.panelBox(s).y != r.y+r.h-ph {
t.Fatalf("unten: %+v", b)
}
if c, rows := a.paneSize(s); c != r.w || rows != r.h-ph {
t.Errorf("Terminalgröße %d×%d", c, rows)
}
body, _ = a.paneBody(s, true)
if n := len(strings.Split(body, "\n")); n != r.h {
t.Errorf("%d Zeilen, erwartet %d", n, r.h)
}
// Höhe ziehen
pb := a.panelBox(s)
a.mouse(tea.MouseClickMsg{X: pb.x + 5, Y: pb.y, Button: tea.MouseLeft})
if !a.panelDrag {
t.Fatal("Rand nicht gegriffen")
}
a.mouse(tea.MouseMotionMsg{X: pb.x + 5, Y: pb.y - 4, Button: tea.MouseLeft})
a.mouse(tea.MouseReleaseMsg{X: pb.x + 5, Y: pb.y - 4, Button: tea.MouseLeft})
if got := a.st.Settings().PanelH; got != ph+4 {
t.Errorf("Höhe %d, erwartet %d", got, ph+4)
}
// zu wenig Zeilen: wieder rechts
a.h = 16
if a.panelDock(s) != dockRight {
t.Error("unten trotz kleinem Fenster")
}
_ = a.resetPanelSize()
if a.st.Settings().PanelH != 0 {
t.Error("nicht zurückgesetzt")
}
}
func TestFilesAndLogBeside(t *testing.T) {
a, s := dockApp(t)
a.w = 200
s.panel = panelNone
r := a.termRect(s)
s.files.open = true
if a.filesBeside(s) {
t.Fatal("ohne Schalter daneben")
}
_ = a.toggleFilesBeside()
if !a.filesBeside(s) || a.termBox(s).w != r.w-a.filesWidth(s) {
t.Fatalf("nicht daneben: %+v", a.termBox(s))
}
body, _ := a.paneBody(s, true)
if !strings.Contains(ansiStrip(body), "keine Verbindung") {
t.Error("Dateien fehlen")
}
// Klick ins Terminal: Tasten gehen ans Terminal
a.mouse(tea.MouseClickMsg{X: r.x + 2, Y: r.y + 2, Button: tea.MouseLeft})
if s.filesFocus() {
t.Fatal("Fokus bleibt bei den Dateien")
}
_ = a.toggleFiles(s) // F5 holt sie nach vorn
if !s.filesFocus() {
t.Fatal("F5 holt die Dateien nicht nach vorn")
}
_ = a.toggleFiles(s) // und schließt
if s.files.open || a.termBox(s).w != r.w {
t.Fatal("nicht zu")
}
// Log-Blick daneben
a.lscan = logScanState{sid: s.id, conn: s.conn, back: scrTerminal}
a.scr = scrLogScan
if !a.logBeside(s) || a.termBox(s).w != r.w-a.filesWidth(s) {
t.Fatal("Log-Blick nicht daneben")
}
if v, _ := a.viewTerminal(); !strings.Contains(ansiStrip(v), "Log-Blick") {
t.Errorf("Log-Blick fehlt:\n%s", v)
}
}
func TestPaneStatus(t *testing.T) {
a, s := dockApp(t)
s.panel = panelNone
_, _ = s.term.Write([]byte("\x1b]7;file://h/srv/www/app/current\x07"))
exit := 2
s.blocks = append(s.blocks, cmdBlock{cmd: "make", failed: true, exit: &exit, dur: 3 * time.Second})
if got := a.paneStatus(s, time.Now()); got != "…/app/current · × 2 3 s" {
t.Errorf("%q", got)
}
_ = a.togglePaneStatus()
if a.paneStatus(s, time.Now()) != "" {
t.Error("Schalter wirkt nicht")
}
if shortDir("~/src") != "~/src" || shortDir("/") != "/" {
t.Error(shortDir("~/src"))
}
}
+37 -17
View File
@@ -36,6 +36,9 @@ func (a *App) panelWidth(s *session) int {
if w < panelNarrow {
return panelRailW
}
if pw, _ := a.panelSizes(); pw > 0 { // mit der Maus gezogen (dock.go)
return clamp(pw, panelMinW, max(panelMinW, w-20))
}
if w >= 110 {
return 48
}
@@ -117,8 +120,8 @@ func (a *App) termSize(s *session) (int, int) {
// paneSize: Platz für das Terminal hier im Fenster.
func (a *App) paneSize(s *session) (int, int) {
r := a.termRect(s)
return max(20, r.w-a.panelWidth(s)), max(3, r.h)
b := a.termBox(s) // ohne Panel (dock.go)
return max(20, b.w), max(3, b.h)
}
func (a *App) resize(s *session) {
@@ -153,13 +156,13 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
if s.detached() && !s.panelFocus {
return nil // Einfügen geht im eigenen Fenster
}
if s.search.open && !s.panelFocus && !s.files.open {
if s.search.open && !s.panelFocus && !s.filesFocus() {
return a.searchPaste(s, m)
}
if g := a.vg; g != nil && g.focus && g.open {
return a.vgPaste(m)
}
if s.files.open {
if s.filesFocus() {
return a.filesPaste(s, m)
}
if s.panelFocus {
@@ -183,29 +186,29 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
a.movePane(dir)
return nil
}
if s.search.open && !s.panelFocus && !s.files.open {
if s.search.open && !s.panelFocus && !s.filesFocus() {
if cmd, ok := a.searchKey(s, m); ok {
return cmd
}
}
// Markieren per Tastatur (copymode.go): hat alle Tasten außer den F-Tasten
if s.copy != nil && !s.panelFocus && !s.files.open {
if s.copy != nil && !s.panelFocus && !s.filesFocus() {
if m.Code >= tea.KeyF1 && m.Code <= tea.KeyF12 {
a.stopCopyMode(s)
} else {
return a.copyKey(s, m)
}
}
if a.keys.is(actCopyMode, key) && !s.panelFocus && !s.files.open && s.term != nil {
if a.keys.is(actCopyMode, key) && !s.panelFocus && !s.filesFocus() && s.term != nil {
a.startCopyMode(s)
return nil
}
// Tippen beendet Markierung und Rückblick (Esc nur das)
if s.scroll > 0 && key == "esc" && !s.panelFocus && !s.files.open {
if s.scroll > 0 && key == "esc" && !s.panelFocus && !s.filesFocus() {
s.scroll, s.sel = 0, nil
return nil
}
if !s.panelFocus && !s.files.open && s.term != nil {
if !s.panelFocus && !s.filesFocus() && s.term != nil {
switch a.keys.which(key, actPrevCmd, actNextCmd, actCmdList) { // Befehle als Blöcke (cmdblocks.go)
case actPrevCmd:
a.jumpBlock(s, -1)
@@ -217,7 +220,7 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
return a.openBlocks(s)
}
}
if !s.panelFocus && !s.files.open && s.term != nil {
if !s.panelFocus && !s.filesFocus() && s.term != nil {
if act := a.keys.which(key, actScrollUp, actScrollDown, actScrollTop, actScrollBottom); act != "" {
if !s.term.AltScreen() {
a.scrollKey(s, act)
@@ -229,7 +232,7 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
}
}
s.sel, s.selecting = nil, false
if !s.panelFocus && !s.files.open && !(m.Code >= tea.KeyF1 && m.Code <= tea.KeyF12) {
if !s.panelFocus && !s.filesFocus() && !(m.Code >= tea.KeyF1 && m.Code <= tea.KeyF12) {
s.scroll = 0
}
if a.keys.is(actVorgang, key) {
@@ -281,7 +284,7 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
}
return nil
}
if s.files.open {
if s.filesFocus() {
return a.filesKey(s, m)
}
if s.detached() && !s.panelFocus {
@@ -347,6 +350,9 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
if a.keys.is(actClipHist, key) {
return a.openClipHist()
}
if a.keys.is(actTasksTerm, key) {
return a.openTasks(s.conn.ID, s.conn.Group)
}
if s.state == stReconnect {
switch key {
case "enter", "r":
@@ -383,6 +389,9 @@ func (a *App) updateTerminal(msg tea.Msg) tea.Cmd {
}
func (a *App) closeTab(s *session) {
if s.conn.Protocol != domain.ProtoWatch {
a.rememberClosed(s)
}
a.vgForget(s)
a.endLog(s)
a.stopRecording(s)
@@ -636,7 +645,7 @@ func (a *App) viewTerminal() (string, *tea.Cursor) {
func (a *App) paneBody(s *session, focused bool) (string, *tea.Cursor) {
st := a.s
cols, rows := a.paneSize(s)
tr := a.termRect(s)
tr := a.termBox(s) // Terminal ohne Panel: links angedockt rückt es nach rechts
if s.search.open {
a.refreshSearch(s, false)
}
@@ -686,8 +695,16 @@ func (a *App) paneBody(s *session, focused bool) (string, *tea.Cursor) {
if s.fixedCols > 0 {
body = cropView(body, cols, rows)
}
if s.files.open {
body, cur = a.viewFiles(s, tr.w, rows), nil
if a.logBeside(s) {
body, cur = beside(body, cols, a.logPaneView(a.filesWidth(s), rows)), nil // Log-Blick daneben (dock.go)
} else if s.files.open && a.filesBeside(s) {
fr := a.filesRect(s)
body = beside(body, cols, a.viewFiles(s, fr.w, fr.h)) // F5 neben dem Terminal (dock.go)
if !s.files.blur {
cur = nil
}
} else if s.files.open {
body, cur = a.viewFiles(s, a.termRect(s).w, rows), nil
} else if s.panel == panelHost && s.host.live.wide && s.host.live.hasLive() {
body, cur = a.viewPanel(s, tr.w, rows), nil // F6 groß: über dem Terminal, ohne dessen Größe zu ändern
} else if a.panelCollapsed(s) {
@@ -704,7 +721,7 @@ func (a *App) paneBody(s *session, focused bool) (string, *tea.Cursor) {
body = beside(body, cols, a.panelRail(s, rows)) // perf.go
}
} else if s.panel != panelNone {
body = beside(body, cols, a.viewPanel(s, a.panelWidth(s), rows))
body = a.dockCompose(s, body) // rechts, links oder unten (dock.go)
}
return body, cur
@@ -755,7 +772,10 @@ func (a *App) terminalKeys(s *session) [][2]string {
if g := a.vg; g != nil && g.focus && g.open {
return a.vgKeys()
}
if s.files.open {
if a.scr == scrLogScan {
return a.logScanKeys() // Log-Blick daneben hat die Tasten
}
if s.filesFocus() {
return a.filesKeys(s)
}
if s.panelFocus {
+1 -1
View File
@@ -22,7 +22,7 @@
│ [=] Alle 6 Verbindungen im Manager Name, Ordner oder #Tag tippen │
│ ── ALLE AKTIONEN ─────────────────────────────────────────────────────── │
│ [/] Suchen & Logs › Verlauf, alle Tabs, Log-Blick, Protokolle 4 │
│ [T] Tabs & Ansicht › neu, teilen, Zoom, Arbeitsplätze 2 │
│ [T] Tabs & Ansicht › neu, teilen, Zoom, Arbeitsplätze 3 │
│ [*] Mehrere Hosts & Netzwerk › Broadcast, Scan, Zeitpläne, Switch… 11 │
│ │
│ ↑↓ wählen ⏎ ausführen Esc schließen │
+1 -1
View File
@@ -22,7 +22,7 @@
│ [=] All 6 connections in the manager type a name, folder or #tag │
│ ── ALL ACTIONS ───────────────────────────────────────────────────────── │
│ [/] Search & logs › scrollback, all tabs, log glance, session logs 4 │
│ [T] Tabs & view › new, split, zoom, workspaces 2 │
│ [T] Tabs & view › new, split, zoom, workspaces 3 │
│ [*] Several hosts & network › broadcast, scan, schedules, switches 11 │
│ │
│ ↑↓ select ⏎ run Esc close │
+1 -1
View File
@@ -1,5 +1,5 @@
>_ sshTermy ▌● 1 web-01 ▌● 2 web-02 ▶ ● 3 db-01 × + ▲ PRODUKTIV postgres@10.0.1.5:2222 ↔ 0 Tunnel ● ◆ qwen3-coder
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ▌ ▲ PROD ● 2 · web-02 deploy@10.0.0.12
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ~ ▌ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ~
│Linux web-01 6.8.0-45-generic #45-Ubuntu SMP x86_64 │ │Linux web-02 6.8.0-45-generic #┌──────────────────────────────┐│
│ │ │ │ i Ansicht: einer groß + zwei ││
│deploy@web-01:~$ systemctl status nginx --no-pager | head -3 │ │deploy@web-02:~$ systemctl stat└──────────────────────────────┘│
+1 -1
View File
@@ -1,5 +1,5 @@
>_ sshTermy ▌● 1 web-01 ▌● 2 web-02 ▶ ● 3 db-01 × + ▲ PRODUCTION postgres@10.0.1.5:2222 ↔ 0 tunnels ● ◆ qwen3-coder
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ▌ ▲ PROD ● 2 · web-02 deploy@10.0.0.12
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ~ ▌ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ~
│Linux web-01 6.8.0-45-generic #45-Ubuntu SMP x86_64 │ │Linux web-02 6.8.0-45-generic #45-Ub┌─────────────────────────┐│
│ │ │ │ i View: one large + two ││
│deploy@web-01:~$ systemctl status nginx --no-pager | head -3 │ │deploy@web-02:~$ systemctl status ng└─────────────────────────┘│
+1 -1
View File
@@ -1,5 +1,5 @@
>_ sshTermy ▌● 1 web-01 ▶ ● 2 web-02 × + ▲ PRODUKTIV deploy@10.0.0.12:22 ↔ 0 Tunnel ● ◆ qwen3-coder
▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ■ Zoom · 1 weitere verdeckt · Alt+Z zurück
▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ~ · ■ Zoom · 1 weitere verdeckt · Alt+Z zurück
┃Linux web-02 6.8.0-45-generic #45-Ubuntu SMP x86_64 ┌────────────────────────────────────────────────┐┃
┃ │ i Zoom: Alt+Z holt die anderen Bereiche zurück │┃
┃deploy@web-02:~$ systemctl status nginx --no-pager | head -3 └────────────────────────────────────────────────┘┃
+1 -1
View File
@@ -1,5 +1,5 @@
>_ sshTermy ▌● 1 web-01 ▶ ● 2 web-02 × + ▲ PRODUCTION deploy@10.0.0.12:22 ↔ 0 tunnels ● ◆ qwen3-coder
▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ■ Zoom · 1 more hidden · Alt+Z back
▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ~ · ■ Zoom · 1 more hidden · Alt+Z back
┃Linux web-02 6.8.0-45-generic #45-Ubuntu SMP x86_64 ┌───────────────────────────────────────────┐┃
┃ │ i Zoom: Alt+Z brings the other panes back │┃
┃deploy@web-02:~$ systemctl status nginx --no-pager | head -3 └───────────────────────────────────────────┘┃
+1 -1
View File
@@ -1,5 +1,5 @@
>_ sshTermy ▌● 1 web-01 ▶ ● 2 web-02 × + ▲ PRODUKTIV deploy@10.0.0.12:22 ↔ 0 Tunnel ● ◆ qwen3-coder
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 Strg+Pfeil wechselt
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ~ ▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ~
│Linux web-01 6.8.0-45-generic #45-Ubuntu SMP x86_64 │ ┃Linux web-02 6.8.0-45-generic #45-┌───────────────────────────────┐┃
│ │ ┃ │ i Ansicht: zwei nebeneinander │┃
│deploy@web-01:~$ systemctl status nginx --no-pager | head -3 │ ┃deploy@web-02:~$ systemctl status └───────────────────────────────┘┃
+1 -1
View File
@@ -1,5 +1,5 @@
>_ sshTermy ▌● 1 web-01 ▶ ● 2 web-02 × + ▲ PRODUCTION deploy@10.0.0.12:22 ↔ 0 tunnels ● ◆ qwen3-coder
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 Ctrl+arrow switches
▌ ▲ PROD ● 1 · web-01 deploy@10.0.0.11 ~ ▶ ▲ PROD ● 2 · web-02 deploy@10.0.0.12 ~
│Linux web-01 6.8.0-45-generic #45-Ubuntu SMP x86_64 │ ┃Linux web-02 6.8.0-45-generic #45-Ubunt┌──────────────────────────┐┃
│ │ ┃ │ i View: two side by side │┃
│deploy@web-01:~$ systemctl status nginx --no-pager | head -3 │ ┃deploy@web-02:~$ systemctl status nginx└──────────────────────────┘┃
+2 -2
View File
@@ -94,7 +94,7 @@ func (a *App) waitTick(s *session, now time.Time) {
msg += " · " + trunc(line, 50)
}
a.pushToast(toastWarn, "? "+msg)
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() {
if a.notifyAway() {
body := waitLabel(kind)
if a.lock == nil && kind != "secret" {
body += ": " + trunc(line, 80)
@@ -203,7 +203,7 @@ func (a *App) agentNotice(s *session, kind noticeKind, text string) {
} else {
a.flashOK("◆ " + s.tabName() + ": " + text)
}
if (a.blurred || a.lock != nil) && a.desktopNotifyOn() {
if a.notifyAway() {
a.sendDesktopFor(s, "sshTermy · "+s.tabName(), text)
}
}
+5
View File
@@ -132,6 +132,9 @@ sudo apt update && sudo apt install sshtermy</pre></div>
<div class="card"><h3>Ziel-Modus im Einsatz</h3><p><kbd>?</kbd> gibt der KI mitten im Ziel eine Anweisung, <kbd>⇧S</kbd> überspringt einen Schritt mit Grund. Fragt ein Befehl <code>[Y/n]</code> oder wartet ein Pager, zeigt das Panel Antwort-Knöpfe. Dateien, die ein Schritt ändert, werden vorher gesichert, <kbd>u</kbd> holt alle zurück; <kbd>f</kbd> startet ein Folgeziel, frühere Ziele stehen im Verlauf. Nach einem Verbindungsabbruch setzt <kbd>⏎</kbd> fort, und der Tab zeigt, wenn ein Ziel auf dich wartet.</p></div>
<div class="card"><h3>Wer auf dich wartet</h3><p>Ein Tab, der auf ein Passwort, eine <code>[j/N]</code>-Frage oder im Pager wartet, bekommt ein <code>?</code>; <kbd>Alt</kbd>+<kbd>G</kbd> springt hin. KI-Coding-Agenten im Tab (Claude Code, Codex, Gemini CLI und mehr) werden erkannt: arbeitet, wartet auf deine Freigabe (<code>◆</code> plus Desktop-Meldung) oder fertig. Ein Klick auf die Desktop-Meldung öffnet den richtigen Tab.</p></div>
<div class="card"><h3>Sitzungen laufen weiter</h3><p>Mit dem Hintergrunddienst überleben Sitzungen das Schließen des Terminalfensters; <code>sshtermy</code> hängt sich wieder an, <kbd>Strg</kbd>+<kbd>Q</kbd> → <kbd>a</kbd> koppelt ab. Beim Start bietet sshTermy an, die Tabs und die geteilte Ansicht vom letzten Mal wieder zu öffnen.</p></div>
<div class="card"><h3>Aufgaben, Diff und Gegenprüfung</h3><p>Offene Arbeiten je Verbindung oder Ordner mit Fälligkeit (<kbd>u</kbd> im Manager, <kbd>Alt</kbd>+<kbd>A</kbd>): <kbd>⏎</kbd> startet eine Aufgabe als Ziel, danach steht sie zur Abnahme. Nach jedem Ziel prüft eine zweite KI nur lesend nach, ob es wirklich erreicht ist, und <kbd>d</kbd> zeigt jede geänderte Datei als Diff.</p></div>
<div class="card"><h3>Panels, wo du sie willst</h3><p>Das Seitenpanel steht rechts, links oder unten, den Rand ziehst du mit der Maus breiter. In breiten Fenstern stehen F5 und der Log-Blick neben dem Terminal, du tippst weiter, während du Dateien ansiehst. In der geteilten Ansicht zeigt jeder Bereich Ordner, letzten Befehl und Last.</p></div>
<div class="card"><h3>Aufs Handy, wenn du weg bist</h3><p>Langer Befehl fertig, Zeitplan gelaufen, ein Agent wartet auf Freigabe: Bist du nicht am Rechner, kommt die Meldung über ntfy, Gotify oder einen Webhook aufs Handy, ohne Geheimnisse. Ein Zeitplan kann die KI nachts nur lesend prüfen lassen („läuft nginx, ist eine Platte voll?“). Wieder geöffnete Tabs zeigen gedämpft die Ausgabe vom letzten Mal.</p></div>
<div class="card"><h3>Weniger tippen, schneller finden</h3><p>Der Ghost-Text schlägt zuerst Befehle aus deinem Verlauf vor, sofort und ohne KI. <kbd>Alt</kbd>+<kbd>Y</kbd> zeigt, was du zuletzt kopiert hast, und fügt es wieder ein. Rechtsklick auf eine Markierung sucht eine Fehlermeldung im Web, F5 öffnet im Ordner, in dem du gerade bist, und der KI-Status zeigt Tokens und Kosten für heute, 7 und 30 Tage.</p></div>
<div class="card"><h3>Tastatur &amp; Kopfzeile</h3><p><kbd>Alt</kbd>+<kbd>C</kbd> markiert per Tastatur (<kbd>v</kbd>, <kbd>V</kbd> Zeilen, <kbd>y</kbd> kopiert), <kbd>Alt</kbd>+<kbd>X</kbd> leert Bildschirm und Verlauf, deine Eingabe bleibt. Die Kopfzeile zeigt auf Wunsch die Uhrzeit oder die Ausgabe eines eigenen Befehls (Git-Zweig, Akku …). KI-Clients können per MCP Tabs öffnen, tippen und warten, mit deiner Bestätigung.</p></div>
<div class="card"><h3>Befehle als Blöcke</h3><p><kbd>Alt</kbd>+<kbd>Bild↑</kbd>/<kbd>Bild↓</kbd> springt im Verlauf von Befehl zu Befehl. <kbd>Alt</kbd>+<kbd>O</kbd> listet die Befehle des Tabs mit Uhrzeit, Dauer und Ergebnis: genau eine Ausgabe kopieren, an die KI geben oder groß lesen.</p></div>
@@ -238,6 +241,8 @@ sudo apt update && sudo apt install sshtermy</pre></div>
<tr><td><kbd>Strg</kbd>+<kbd>F</kbd></td><td>Im Verlauf suchen</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>S</kbd></td><td>In allen offenen Tabs suchen</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>G</kbd></td><td>Zum nächsten Tab, der wartet (<code>?</code>) oder sich gemeldet hat (<code>◆</code> KI-Agent wartet, ✓/×)</td></tr>
<tr><td><kbd>u</kbd> (Manager) / <kbd>Alt</kbd>+<kbd>A</kbd></td><td>Aufgaben der Verbindung bzw. des Ordners: <kbd>⏎</kbd> als Ziel starten, <kbd>a</kbd> abhaken</td></tr>
<tr><td><kbd>d</kbd> / <kbd>g</kbd> (nach dem Ziel)</td><td>Änderungen als Diff / Gegenprüfung</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>Y</kbd></td><td>Zwischenablage-Verlauf: zuletzt Kopiertes wieder einfügen</td></tr>
<tr><td>Rechtsklick auf Markierung</td><td>Kopieren, im Web suchen, einfügen</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>C</kbd> / <kbd>Alt</kbd>+<kbd>X</kbd></td><td>Per Tastatur markieren (<kbd>v</kbd>, <kbd>V</kbd>, <kbd>y</kbd> kopiert, <kbd>Esc</kbd>) / Bildschirm und Verlauf leeren, Eingabe bleibt</td></tr>
Binary file not shown.
Binary file not shown.
+5
View File
@@ -132,6 +132,9 @@ sudo apt update && sudo apt install sshtermy</pre></div>
<div class="card"><h3>Goal mode in daily use</h3><p><kbd>?</kbd> gives the AI an instruction mid-goal, <kbd>⇧S</kbd> skips a step with a reason. When a command asks <code>[Y/n]</code> or a pager waits, the panel shows answer buttons. Files a step changes are backed up first, <kbd>u</kbd> restores them all; <kbd>f</kbd> starts a follow-up goal, earlier goals are in the history. After a connection drop <kbd>⏎</kbd> continues, and the tab shows when a goal is waiting for you.</p></div>
<div class="card"><h3>Who is waiting for you</h3><p>A tab waiting for a password, a <code>[y/N]</code> question or a pager gets a <code>?</code>; <kbd>Alt</kbd>+<kbd>G</kbd> jumps there. AI coding agents in a tab (Claude Code, Codex, Gemini CLI and more) are recognized: working, waiting for your approval (<code>◆</code> plus desktop notification) or done. A click on the desktop notification opens the right tab.</p></div>
<div class="card"><h3>Sessions keep running</h3><p>With the background service, sessions survive closing the terminal window; <code>sshtermy</code> attaches again, <kbd>Ctrl</kbd>+<kbd>Q</kbd> → <kbd>a</kbd> detaches. At start sshTermy offers to reopen the tabs and split view from last time.</p></div>
<div class="card"><h3>Tasks, diff and cross-check</h3><p>Open work per connection or folder with a due date (<kbd>u</kbd> in the manager, <kbd>Alt</kbd>+<kbd>A</kbd>): <kbd>⏎</kbd> starts a task as a goal, then it waits for your review. After every goal a second AI checks read-only whether it was really reached, and <kbd>d</kbd> shows every changed file as a diff.</p></div>
<div class="card"><h3>Panels where you want them</h3><p>The side panel sits on the right, left or bottom, drag its edge to make it wider. In wide windows F5 and the log view sit beside the terminal, so you keep typing while you browse files. In split view every pane shows its folder, last command and load.</p></div>
<div class="card"><h3>To your phone when you are away</h3><p>Long command done, schedule ran, an agent waits for approval: when you are not at the computer, the notification goes to your phone via ntfy, Gotify or a webhook, without secrets. A schedule can let the AI check read-only at night (“is nginx running, is a disk full?”). Reopened tabs show the output from last time, dimmed.</p></div>
<div class="card"><h3>Type less, find faster</h3><p>Ghost text suggests commands from your history first, instantly and without AI. <kbd>Alt</kbd>+<kbd>Y</kbd> shows what you copied recently and pastes it again. Right-click a selection to search an error message on the web, F5 opens in the folder you are in, and the AI status shows tokens and cost for today, 7 and 30 days.</p></div>
<div class="card"><h3>Keyboard &amp; header</h3><p><kbd>Alt</kbd>+<kbd>C</kbd> selects by keyboard (<kbd>v</kbd>, <kbd>V</kbd> lines, <kbd>y</kbd> copies), <kbd>Alt</kbd>+<kbd>X</kbd> clears screen and scrollback but keeps your input. The header can show the time or the output of your own command (git branch, battery …). AI clients can open tabs, type and wait via MCP, with your confirmation.</p></div>
<div class="card"><h3>Commands as blocks</h3><p><kbd>Alt</kbd>+<kbd>PgUp</kbd>/<kbd>PgDn</kbd> jumps from command to command in the scrollback. <kbd>Alt</kbd>+<kbd>O</kbd> lists the tab's commands with time, duration and result: copy exactly one output, hand it to the AI or read it in full.</p></div>
@@ -238,6 +241,8 @@ sudo apt update && sudo apt install sshtermy</pre></div>
<tr><td><kbd>Ctrl</kbd>+<kbd>F</kbd></td><td>Search the scrollback</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>S</kbd></td><td>Search in all open tabs</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>G</kbd></td><td>Go to the next tab that waits (<code>?</code>) or has a notice (<code>◆</code> AI agent waiting, ✓/×)</td></tr>
<tr><td><kbd>u</kbd> (manager) / <kbd>Alt</kbd>+<kbd>A</kbd></td><td>Tasks of the connection or folder: <kbd>⏎</kbd> start as goal, <kbd>a</kbd> check off</td></tr>
<tr><td><kbd>d</kbd> / <kbd>g</kbd> (after a goal)</td><td>Changes as a diff / cross-check</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>Y</kbd></td><td>Clipboard history: paste something you copied earlier</td></tr>
<tr><td>Right-click a selection</td><td>Copy, search the web, paste</td></tr>
<tr><td><kbd>Alt</kbd>+<kbd>C</kbd> / <kbd>Alt</kbd>+<kbd>X</kbd></td><td>Select by keyboard (<kbd>v</kbd>, <kbd>V</kbd>, <kbd>y</kbd> copies, <kbd>Esc</kbd>) / clear screen and scrollback, input stays</td></tr>
+8 -8
View File
@@ -38,7 +38,7 @@ export const de = {
['c', 'SSH-Schlüssel erzeugen / übertragen'],
['q', 'Schnellbefehle bearbeiten'],
['m / f / z', 'Broadcast / Netzwerk-Scan / Zeitpläne'],
['w / g', 'Arbeitsplätze / Ordner als Raster öffnen'],
['w / g · u', 'Arbeitsplätze / Raster · Aufgaben'],
['s / y', 'KI-Einstellungen / Sync zwischen Rechnern'],
['i', 'importieren (ssh config, PuTTY, MobaXterm, Ansible, CSV)'],
['l', 'Sitzungsprotokolle'],
@@ -61,7 +61,7 @@ export const de = {
['F7 / F8', 'Tab zurück / vor'],
['Alt+N / Alt+W', 'neuer Tab (Manager, auch +) / Tab schließen'],
['Alt+L', 'lokale Shell (PowerShell, zsh …)'],
['Alt+T / G', 'Tab-Liste · Tab, der wartet (? ◆)'],
['Alt+T / G / A', 'Tabs · wartet (? ◆) · Aufgaben'],
['Strg+R / D', '(Liste) umbenennen / duplizieren'],
['Alt+S', 'in allen Tabs suchen'],
['Alt+O', 'Befehle des Tabs · Alt+Bild↑↓ springt'],
@@ -78,7 +78,7 @@ export const de = {
['_Titel ziehen_', 'Bereiche tauschen'],
]},
{ t: 'Maus', ic: '◦', rows: [
['_Ziehen_', 'markieren + kopieren, auch im Panel'],
['_Ziehen_', 'markieren + kopieren · Panelrand: Größe'],
['_Rechtsklick_', 'einfügen · Markierung/Link: Menü, Web-Suche'],
['Strg+_Klick_', 'URL im Browser öffnen'],
['⇧+_Ziehen_', 'markieren in htop / vim'],
@@ -103,7 +103,7 @@ export const de = {
['e / s / r', 'ändern / auslassen / neu'],
['? / ⇧S', 'KI anweisen / auslassen mit Grund'],
['x', 'Ziel beenden'],
['f / u', 'Folgeziel / Änderungen zurückholen'],
['f / u · d / g', 'Folgeziel / zurück · Diff / prüfen'],
['↑ / ↓', 'Runbook oder früheres Ziel'],
['Strg+S / D', 'als Runbook speichern / löschen'],
['Tab', 'Modus: Schritt → Agent → Erst planen'],
@@ -226,7 +226,7 @@ export const en = {
['c', 'create / copy an SSH key'],
['q', 'edit quick commands'],
['m / f / z', 'broadcast / network scan / schedules'],
['w / g', 'workspaces / open folder as a grid'],
['w / g · u', 'workspaces / grid · tasks'],
['s / y', 'AI settings / sync between computers'],
['i', 'import (ssh config, PuTTY, MobaXterm, Ansible, CSV)'],
['l', 'session logs'],
@@ -250,7 +250,7 @@ export const en = {
['F7 / F8', 'previous / next tab'],
['Alt+N / Alt+W', 'new tab (manager, also +) / close tab'],
['Alt+L', 'local shell (PowerShell, zsh …)'],
['Alt+T / G', 'tab list · tab that waits (? ◆)'],
['Alt+T / G · A', 'tab list · waits (? ◆) · tasks'],
['Ctrl+R / D', '(list) rename / duplicate'],
['Alt+S', 'search in all tabs'],
['Alt+O', 'tab commands · Alt+PgUp/Dn jumps'],
@@ -267,7 +267,7 @@ export const en = {
['_drag title_', 'swap panes'],
]},
{ t: 'Mouse', ic: '◦', rows: [
['_drag_', 'select + copy, also in the panel'],
['_drag_', 'select + copy · panel edge: resize'],
['_right-click_', 'paste · selection/link: menu, web search'],
['Ctrl+_click_', 'open URL in the browser'],
['⇧+_drag_', 'select inside htop / vim'],
@@ -292,7 +292,7 @@ export const en = {
['e / s / r', 'edit / skip / suggest again'],
['? / ⇧S', 'instruct the AI / skip with a reason'],
['x', 'end the goal'],
['f / u', 'follow-up goal / restore changes'],
['f / u · d / g', 'follow-up / restore · diff / cross-check'],
['↑ / ↓', 'runbook or earlier goal'],
['Ctrl+S / D', 'save as runbook / delete'],
['⇧⏎ / Ctrl+J', 'new line in the goal'],
+1 -1
View File
@@ -1 +1 @@
e58489d9c8b490e8fe72c9ba3facec354631c1f5269b75d4b5b7e9ff478ee333
db235e8efed010d0419137fc3cc52833594d6990f0bdde97dfb3551a6a0db143