Verdrahtet die neuen Kanaele "dunkel" (noch ohne UI):
- rvs/server.js: ALLOWED_TYPES um code_file/code_file_edit, check_desktop/
desktop_status und vnc_open/close/data/input erweitert (Base64-in-JSON-Relay
wie audio_pcm, kein Binaer-Handling noetig).
- brainApi.ts: Project.kind ('code'|'chat') + desktop_url; ChatScreen publiziert
die Kinds in den projectFocus-Spiegel.
- services/codeFile.ts: Live-Spiegel der Code-Dateien (content + Deltas) mit
Ruckkanal code_file_edit fuer eigene Edits.
- services/desktop.ts: Desktop-Status + VNC-RFB-Tunnel (vnc_open/close/input/
data) durch RVS, Session = Projekt-ID.
tsc clean, rvs/server.js syntaktisch OK.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
136 lines
4.7 KiB
TypeScript
136 lines
4.7 KiB
TypeScript
/**
|
|
* codeFile — Live-Spiegel der Code-Dateien, die ARIA in einem Code-Projekt
|
|
* schreibt, plus Ruckkanal fuer eigene Edits.
|
|
*
|
|
* Fluss: ARIAs Write/Edit (proxy) → Bridge → RVS `code_file` → hier gepuffert →
|
|
* CodeEditorTile zeigt es in CodeMirror. Tippt Stefan im Editor, geht das als
|
|
* `code_file_edit` ueber RVS zurueck an die Bridge (schreibt die Datei).
|
|
*
|
|
* Der Service haelt pro (projectId,path) den aktuellen Volltext, damit eine
|
|
* spaet gemountete Editor-Kachel sofort den Ist-Stand bekommt (setContent) und
|
|
* danach nur noch Deltas anwendet. Muster wie services/rvs.ts (Singleton).
|
|
*/
|
|
|
|
import rvs, { RVSMessage } from './rvs';
|
|
|
|
export interface CodePatch {
|
|
from: number;
|
|
to: number;
|
|
insert: string;
|
|
}
|
|
|
|
/** Persistenter Zustand einer Datei im Spiegel. */
|
|
export interface CodeFileState {
|
|
projectId: string;
|
|
path: string;
|
|
language: string;
|
|
content: string;
|
|
version: number;
|
|
}
|
|
|
|
/** Ein eingehendes Update — entweder Voll-Ersatz (content) oder Delta (patch). */
|
|
export interface CodeFileUpdate {
|
|
projectId: string;
|
|
path: string;
|
|
language: string;
|
|
version: number;
|
|
content?: string;
|
|
patch?: CodePatch;
|
|
}
|
|
|
|
type UpdateSub = (u: CodeFileUpdate) => void;
|
|
|
|
const SEP = ' |