feat: prepare Zhinian desktop client for pilot release
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export const SUPPORTED_LANGUAGE_CODES = ['en', 'zh', 'ja', 'ru'] as const;
|
||||
export const SUPPORTED_LANGUAGE_CODES = ['en', 'zh'] as const;
|
||||
|
||||
export type LanguageCode = (typeof SUPPORTED_LANGUAGE_CODES)[number];
|
||||
|
||||
|
||||
146
shared/yinian.ts
Normal file
146
shared/yinian.ts
Normal file
@@ -0,0 +1,146 @@
|
||||
export type YinianControlPlaneMode = 'mock' | 'http';
|
||||
|
||||
export interface YinianServerStatus {
|
||||
mode: YinianControlPlaneMode;
|
||||
apiBaseUrl?: string;
|
||||
reachable: boolean;
|
||||
checkedAt: number;
|
||||
serverTime?: number;
|
||||
version?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface YinianUser {
|
||||
id: string;
|
||||
name: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
avatar?: string;
|
||||
}
|
||||
|
||||
// Compatibility note: early M1 contracts used "hotel" as the tenant object
|
||||
// name. The product surface now treats this as a generic B-end workspace or
|
||||
// business object, while the field names remain stable for storage/API safety.
|
||||
export interface YinianHotel {
|
||||
id: string;
|
||||
name: string;
|
||||
brand?: string;
|
||||
}
|
||||
|
||||
export interface YinianAuthSession {
|
||||
authenticated: true;
|
||||
user: YinianUser;
|
||||
hotels: YinianHotel[];
|
||||
currentHotelId: string;
|
||||
accessTokenExpiresAt: number;
|
||||
}
|
||||
|
||||
export interface YinianUnauthenticatedSession {
|
||||
authenticated: false;
|
||||
}
|
||||
|
||||
export type YinianSessionState = YinianAuthSession | YinianUnauthenticatedSession;
|
||||
|
||||
export interface YinianPersistedSession {
|
||||
mode: YinianControlPlaneMode;
|
||||
user: YinianUser;
|
||||
hotels: YinianHotel[];
|
||||
currentHotelId: string;
|
||||
accessTokenExpiresAt: number;
|
||||
refreshToken?: string;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
export interface YinianLoginWithSmsInput {
|
||||
phone: string;
|
||||
code: string;
|
||||
captchaCode?: string;
|
||||
randomStr?: string;
|
||||
}
|
||||
|
||||
export interface YinianLoginWithPasswordInput {
|
||||
account: string;
|
||||
password: string;
|
||||
captchaCode?: string;
|
||||
randomStr?: string;
|
||||
}
|
||||
|
||||
export interface YinianImageCaptcha {
|
||||
randomStr: string;
|
||||
image?: string;
|
||||
imageBase64?: string;
|
||||
mimeType?: string;
|
||||
raw?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface YinianSavedCredentials {
|
||||
account: string;
|
||||
password?: string;
|
||||
rememberPassword: boolean;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
export interface YinianSkillEntitlement {
|
||||
skillId: string;
|
||||
name: string;
|
||||
version: string;
|
||||
enabled: boolean;
|
||||
category: 'ota-monitoring' | 'reporting' | 'guest-comm' | 'ops-automation';
|
||||
triggers: Array<'manual' | 'scheduled' | 'webhook' | 'reply'>;
|
||||
lastRunAt?: number;
|
||||
}
|
||||
|
||||
export type YinianSkillSyncStatus = 'installed' | 'updated' | 'skipped' | 'disabled' | 'failed';
|
||||
|
||||
export interface YinianLocalSkill {
|
||||
skillId: string;
|
||||
name: string;
|
||||
version: string;
|
||||
enabled: boolean;
|
||||
installedAt: number;
|
||||
lastSyncedAt: number;
|
||||
status: YinianSkillSyncStatus;
|
||||
source: 'mock' | 'nianxx';
|
||||
bundleSha256?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface YinianSkillSyncResult {
|
||||
hotelId: string;
|
||||
syncedAt: number;
|
||||
skills: YinianLocalSkill[];
|
||||
}
|
||||
|
||||
export interface YinianSkillRegistry {
|
||||
hotelId: string;
|
||||
updatedAt: number;
|
||||
skills: YinianLocalSkill[];
|
||||
}
|
||||
|
||||
export type YinianSkillRegistryByHotel = Record<string, YinianSkillRegistry>;
|
||||
|
||||
export type YinianWorkspace = YinianHotel;
|
||||
export type YinianSkillRegistryByWorkspace = YinianSkillRegistryByHotel;
|
||||
|
||||
export interface YinianNotificationChannel {
|
||||
id: string;
|
||||
kind: string;
|
||||
label: string;
|
||||
recipient: string;
|
||||
enabled: boolean;
|
||||
source: 'kernel' | 'nianxx';
|
||||
}
|
||||
|
||||
export interface YinianConfigSnapshot {
|
||||
serverTime: number;
|
||||
user: YinianUser;
|
||||
hotel: YinianHotel;
|
||||
hotels: YinianHotel[];
|
||||
entitlements: YinianSkillEntitlement[];
|
||||
notificationChannels: YinianNotificationChannel[];
|
||||
featureFlags: Record<string, boolean>;
|
||||
uiPolicy: {
|
||||
defaultPage: 'today' | 'chat';
|
||||
showAdvancedSettings: boolean;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user