feat(k1): complete canonical control lifecycle

This commit is contained in:
DCCONSTRUCTIONS
2026-07-19 01:07:02 +03:00
parent d7a2c22faf
commit ffffee1879
42 changed files with 3577 additions and 556 deletions
+42 -3
View File
@@ -138,7 +138,34 @@ export interface XgridsApplicationControlSession {
outcome_unknown: boolean;
failure?: {
code?: string;
reason_code?: string;
message?: string;
failed_phase?: string | null;
dialogue_stage?: string | null;
transport_state?: string | null;
publish_attempts?: number | null;
qos2_completions?: number | null;
correlated_responses?: number | null;
ignored_known_responses?: number | null;
late_known_responses?: number | null;
modeling_command_attempted?: boolean | null;
diagnostic_snapshot_unavailable?: string[];
diagnostic_evidence_unavailable?: string[];
correlation_failure?: {
phase?: string;
operation_key?: string;
response_topic?: string;
reason_code?: string;
reason?: string;
} | null;
compatibility_failure?: {
phase?: string;
operation_key?: string;
response_topic?: string;
reason_code?: string;
expected?: Record<string, unknown>;
observed?: Record<string, unknown>;
} | null;
safe_to_retry?: boolean;
} | null;
dialogue?: Record<string, unknown> | null;
@@ -153,6 +180,8 @@ export interface XgridsAcquisition {
compatibility_profile_id: string;
control_mode: "operator-manual" | "plugin-commanded" | "observe-only";
project_name?: string | null;
mount_type?: "handheld" | null;
gnss_mode?: "none" | null;
cleanup_pending?: boolean;
requested_streams: string[];
target_host: string;
@@ -260,6 +289,7 @@ export interface XgridsK1State {
devices?: BleDevice[];
selected_device_id?: string | null;
k1_ip?: string | null;
connection_mode?: "bridge" | null;
foxglove_ws_url?: string | null;
foxglove_viewer_url?: string | null;
rerun_grpc_url?: string | null;
@@ -293,13 +323,14 @@ export interface ScanRequest {
export interface CompatibilityAttestation {
firmware_version: "3.0.2";
topology: "direct-lan";
operator_confirmed: true;
verification: "live-device-info";
}
export interface ConnectRequest {
device_id: string;
ssid: string;
password: string;
connection_mode: "bridge";
compatibility_attestation: CompatibilityAttestation;
operation_id?: string;
idempotency_key?: string;
@@ -307,6 +338,8 @@ export interface ConnectRequest {
export interface PrepareAcquisitionRequest {
project_name: string;
mount_type: "handheld";
gnss_mode: "none";
host?: string;
duration_seconds?: number;
requested_streams?: RequestedStreamId[];
@@ -398,11 +431,13 @@ export interface EnterApplicationWorkspaceRequest {
export class ApiError extends Error {
readonly status: number;
readonly transportUnavailable: boolean;
constructor(message: string, status = 0) {
constructor(message: string, status = 0, transportUnavailable = false) {
super(message);
this.name = "ApiError";
this.status = status;
this.transportUnavailable = transportUnavailable;
}
}
@@ -433,7 +468,11 @@ async function requestJson(path: string, init?: RequestInit): Promise<unknown> {
},
});
} catch {
throw new ApiError("Не удалось подключиться к локальному сервису устройства.");
throw new ApiError(
"Не удалось подключиться к локальному сервису устройства.",
0,
true,
);
}
const bodyText = await response.text();