Files
agentic-mobile-control/cloud-console/src/types.ts
T
2026-07-15 18:14:28 +08:00

234 lines
4.9 KiB
TypeScript

export type TaskStatus =
| "queued"
| "assigned"
| "dispatched"
| "done"
| "failed";
export interface TaskListItem {
id: string;
status: TaskStatus;
goal: string | null;
workflow_definition_id: string | null;
assigned_device_id: string | null;
assigned_host_id: string | null;
attempt_count: number;
failure_reason: string | null;
target_host_id: string | null;
target_device_id: string | null;
created_at: string;
progress_step_index?: number | null;
progress_step_status?: string | null;
progress_summary?: string | null;
progress_updated_at?: string | null;
}
export interface TaskSubmissionPayload {
goal?: string;
workflow_definition_id?: string;
constraints?: {
driver_type?: string;
capability_tags?: string[];
target_host_id?: string;
target_device_id?: string;
};
}
export interface TaskListResponse {
items: TaskListItem[];
total: number;
limit: number;
offset: number;
}
export interface TaskAttempt {
task_id: string;
attempt: number;
lease_id: string;
host_id: string;
device_id: string;
status: string;
lease_expires_at: string;
created_at: string;
completed_at: string | null;
failure_reason: string | null;
terminal_result: Record<string, unknown> | null;
}
export interface DeviceRecord {
device_id: string;
host_id: string;
driver_type: string;
status: string;
capability_tags: string[];
}
export interface HostRecord {
host_id: string;
address: string | null;
last_seen_at: string;
planner_transport: "direct" | "cloud";
}
export type PluginEntryPointKind = "driver" | "tool" | "skill";
export interface PluginRecord {
name: string;
version: string;
entry_point_kind: string;
target: string;
wired: boolean;
}
export interface PluginRegistrationPayload {
name: string;
version: string;
entry_point_kind: PluginEntryPointKind;
target: string;
}
export type UserRole = "viewer" | "operator" | "admin";
export interface CloudUser {
id: string;
username: string;
display_name: string;
role: UserRole;
enabled: boolean;
must_change_password: boolean;
scopes: string[];
created_at: string;
updated_at: string;
last_login_at: string | null;
}
export interface UserListResponse {
items: CloudUser[];
limit: number;
offset: number;
}
export interface DeviceTarget {
host_id: string;
device_id: string;
}
export interface UserSubmissionPolicy {
user_id: string;
revision: number;
submission_enabled: boolean;
allowed_host_ids: string[] | null;
allowed_device_targets: DeviceTarget[] | null;
updated_at: string;
}
export interface HostGovernancePolicy {
host_id: string;
revision: number;
self_submission_enabled: boolean;
max_active_tasks: number | null;
daily_token_budget: number | null;
updated_at: string;
}
export interface HostTokenUsageSummary {
host_id: string;
usage_day: string;
daily_token_budget: number | null;
used_tokens: number;
reserved_tokens: number;
remaining_tokens: number | null;
}
export interface TokenUsageEvent {
id: string;
host_id: string;
usage_day: string;
task_id: string | null;
attempt: number | null;
provider: string;
model: string;
input_tokens: number | null;
output_tokens: number | null;
total_tokens: number;
occurred_at: string;
}
export type LlmProviderType = "anthropic" | "openai-compatible";
export interface LlmProviderProfile {
id: string;
name: string;
provider_type: LlmProviderType;
model: string;
base_url: string | null;
timeout_seconds: number;
enabled: boolean;
revision: number;
has_api_key: boolean;
key_last_rotated_at: string;
created_at: string;
updated_at: string;
active: boolean;
}
export interface LlmProviderSettings {
active_profile_id: string | null;
revision: number;
updated_at: string | null;
}
export interface LlmProviderProfileListResponse {
settings: LlmProviderSettings;
items: LlmProviderProfile[];
}
export interface PlannerDecisionItem {
step_index: number;
attempt: number;
system_prompt: string;
user_prompt: string;
tool_name: string;
arguments: Record<string, unknown>;
rationale?: string | null;
thinking?: string | null;
purpose?: string | null;
expected_outcome?: string | null;
created_at: string;
}
export interface PlannerDecisionListResponse {
items: PlannerDecisionItem[];
}
export type CloudSkillKind = "knowledge" | "flow_template";
export interface CloudSkill {
id: string;
name: string;
kind: CloudSkillKind;
description: string;
tags: string[];
revision: number;
created_at: string;
updated_at: string;
content: string;
steps: Record<string, unknown>[];
parameters: Record<string, Record<string, unknown>>;
}
export interface CloudSkillListResponse {
items: CloudSkill[];
}
export interface CloudSkillEntitlementsResponse {
skill_id: string;
host_ids: string[];
}
export interface HostSkillInventoryResponse {
host_id: string;
payload: Record<string, unknown>[];
reported_at: string | null;
}