feat: host session list/terminate and event session actions (0.20.28)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -573,6 +573,56 @@ export function fetchHostRemoteJob(hostId: number): Promise<HostRemoteActionJobS
|
||||
return apiFetch<HostRemoteActionJobStatus>(`/api/v1/hosts/${hostId}/actions/remote-job`);
|
||||
}
|
||||
|
||||
export interface HostSessionItem {
|
||||
session_id: string;
|
||||
user: string;
|
||||
tty?: string | null;
|
||||
state?: string | null;
|
||||
source_ip?: string | null;
|
||||
session_name?: string | null;
|
||||
}
|
||||
|
||||
export interface HostSessionsResponse {
|
||||
ok: boolean;
|
||||
message: string;
|
||||
target?: string | null;
|
||||
sessions: HostSessionItem[];
|
||||
}
|
||||
|
||||
export interface HostSessionTerminateResponse {
|
||||
ok: boolean;
|
||||
message: string;
|
||||
target?: string | null;
|
||||
stdout?: string | null;
|
||||
stderr?: string | null;
|
||||
}
|
||||
|
||||
export function fetchHostSessions(hostId: number): Promise<HostSessionsResponse> {
|
||||
return apiFetch<HostSessionsResponse>(`/api/v1/hosts/${hostId}/actions/sessions/list`, {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
export function terminateHostSession(
|
||||
hostId: number,
|
||||
sessionId: string,
|
||||
): Promise<HostSessionTerminateResponse> {
|
||||
return apiFetch<HostSessionTerminateResponse>(`/api/v1/hosts/${hostId}/actions/sessions/terminate`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ session_id: sessionId }),
|
||||
});
|
||||
}
|
||||
|
||||
export function postEventTerminateSession(
|
||||
eventId: number,
|
||||
sessionId?: string,
|
||||
): Promise<HostSessionTerminateResponse> {
|
||||
return apiFetch<HostSessionTerminateResponse>(`/api/v1/events/${eventId}/actions/terminate-session`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(sessionId ? { session_id: sessionId } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
export interface HostAgentConfigResponse {
|
||||
config_revision: number;
|
||||
settings: Record<string, unknown>;
|
||||
|
||||
Reference in New Issue
Block a user