mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-07 23:09:21 +08:00
[feat] add MCP terminal views and agent cursor overlays
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
} from "./common.js";
|
||||
import { DeviceStore, type Device } from "./store.js";
|
||||
import { nativeBinary, NativeClient } from "./native.js";
|
||||
import { displayEnvironment } from "./environment.js";
|
||||
|
||||
export interface View {
|
||||
id: string;
|
||||
@@ -46,7 +47,9 @@ export class Sessions {
|
||||
) {}
|
||||
choose(apps: boolean): View["panel"] {
|
||||
if (this.policy === "apps" && !apps) throw new Failure("PANEL_UNSUPPORTED");
|
||||
return this.policy === "auto" ? (apps ? "apps" : "browser") : this.policy;
|
||||
if (this.policy !== "auto") return this.policy;
|
||||
const environment = displayEnvironment();
|
||||
return environment.gui ? "browser" : environment.terminal ? "terminal" : "off";
|
||||
}
|
||||
create(panel: View["panel"], alias?: string): View {
|
||||
for (const [id, view] of this.views)
|
||||
@@ -383,6 +386,12 @@ export class Sessions {
|
||||
operation,
|
||||
});
|
||||
}
|
||||
async terminalFrame(v: View, args: Data, signal?: AbortSignal) {
|
||||
if (v.panel !== "terminal" || !v.session || this.connecting)
|
||||
throw new Failure("NOT_READY");
|
||||
const s = this.session(v.session);
|
||||
return s.native.request("terminal_frame", args, 5000, signal);
|
||||
}
|
||||
async openVideo(v: View, origin: string): Promise<Data> {
|
||||
if (!v.session || this.views.get(v.id) !== v) throw new Failure("NOT_READY");
|
||||
const s = this.session(v.session);
|
||||
|
||||
Reference in New Issue
Block a user