feat(k1): wire canonical control session to UI
This commit is contained in:
@@ -104,6 +104,47 @@ export interface XgridsApplicationControlExecution {
|
||||
can_emit_requests: false;
|
||||
}
|
||||
|
||||
export type XgridsApplicationControlPhase =
|
||||
| "idle"
|
||||
| "connecting"
|
||||
| "connection-ready"
|
||||
| "workspace-requested"
|
||||
| "workspace-ready"
|
||||
| "project-requested"
|
||||
| "project-ready"
|
||||
| "start-requested"
|
||||
| "initializing"
|
||||
| "scanning"
|
||||
| "stop-requested"
|
||||
| "stopping"
|
||||
| "awaiting-standby-confirmation"
|
||||
| "completed"
|
||||
| "closed"
|
||||
| "failed";
|
||||
|
||||
export interface XgridsApplicationControlSession {
|
||||
mode: "interactive-canonical";
|
||||
state: XgridsApplicationControlPhase;
|
||||
control_socket_open: boolean;
|
||||
can_open: boolean;
|
||||
can_enter_workspace: boolean;
|
||||
can_prepare_project: boolean;
|
||||
can_start: boolean;
|
||||
can_stop: boolean;
|
||||
can_confirm_standby: boolean;
|
||||
pending_operator_action?: string | null;
|
||||
scripted_transitions: false;
|
||||
automatic_retry: false;
|
||||
outcome_unknown: boolean;
|
||||
failure?: {
|
||||
code?: string;
|
||||
message?: string;
|
||||
safe_to_retry?: boolean;
|
||||
} | null;
|
||||
dialogue?: Record<string, unknown> | null;
|
||||
transport?: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface XgridsAcquisition {
|
||||
schema_version?: string;
|
||||
acquisition_id: string;
|
||||
@@ -228,6 +269,7 @@ export interface XgridsK1State {
|
||||
compatibility?: XgridsCompatibilityState | null;
|
||||
modeling_control_safety?: XgridsModelingControlSafety | null;
|
||||
application_control_execution?: XgridsApplicationControlExecution | null;
|
||||
application_control_session?: XgridsApplicationControlSession | null;
|
||||
device_ref?: XgridsDeviceRef | null;
|
||||
device_session?: XgridsDeviceSession | null;
|
||||
acquisition?: XgridsAcquisition | null;
|
||||
@@ -288,6 +330,7 @@ export interface StartAcquisitionRequest {
|
||||
operation_id?: string;
|
||||
idempotency_key?: string;
|
||||
deadline_seconds?: number;
|
||||
physical_acceptance?: OperatorPresenceConfirmation;
|
||||
}
|
||||
|
||||
export interface StopAcquisitionRequest {
|
||||
@@ -297,6 +340,7 @@ export interface StopAcquisitionRequest {
|
||||
operation_id?: string;
|
||||
idempotency_key?: string;
|
||||
deadline_seconds?: number;
|
||||
physical_acceptance?: OperatorPresenceConfirmation;
|
||||
}
|
||||
|
||||
export interface AbortAcquisitionRequest {
|
||||
@@ -335,6 +379,23 @@ export interface ShadowApplicationControlArmRequest {
|
||||
timezone_name: string;
|
||||
}
|
||||
|
||||
export interface OperatorPresenceConfirmation {
|
||||
operator_present: true;
|
||||
owner_controlled_device: true;
|
||||
lixelgo_closed: true;
|
||||
battery_storage_confirmed: true;
|
||||
expected_physical_state_confirmed: true;
|
||||
}
|
||||
|
||||
export interface OpenApplicationControlSessionRequest
|
||||
extends OperatorPresenceConfirmation {
|
||||
timezone_name: string;
|
||||
}
|
||||
|
||||
export interface EnterApplicationWorkspaceRequest {
|
||||
operator_confirmed: true;
|
||||
}
|
||||
|
||||
export class ApiError extends Error {
|
||||
readonly status: number;
|
||||
|
||||
@@ -496,6 +557,22 @@ export const xgridsK1Api = {
|
||||
disarmShadowApplicationControl(): Promise<XgridsK1State> {
|
||||
return invokeState(xgridsK1Actions.applicationControlShadowDisarm);
|
||||
},
|
||||
|
||||
openApplicationControlSession(
|
||||
body: OpenApplicationControlSessionRequest,
|
||||
): Promise<XgridsK1State> {
|
||||
return invokeState(xgridsK1Actions.applicationControlSessionOpen, body);
|
||||
},
|
||||
|
||||
enterApplicationWorkspace(
|
||||
body: EnterApplicationWorkspaceRequest,
|
||||
): Promise<XgridsK1State> {
|
||||
return invokeState(xgridsK1Actions.applicationControlWorkspaceEnter, body);
|
||||
},
|
||||
|
||||
closeApplicationControlSession(): Promise<XgridsK1State> {
|
||||
return invokeState(xgridsK1Actions.applicationControlSessionClose);
|
||||
},
|
||||
};
|
||||
|
||||
export type EventSocketStatus = "connecting" | "open" | "closed" | "error";
|
||||
|
||||
Reference in New Issue
Block a user