chore: checkpoint admin restore state

This commit is contained in:
john
2026-06-30 20:26:33 +08:00
parent f2172322fd
commit f9a7584ad4
63 changed files with 7555 additions and 1030 deletions
+245
View File
@@ -18,6 +18,10 @@ export type PortalUser = {
balanceCents: number;
totalCreditCents?: number;
tokensUsed: number;
spaceQuotaBytes?: number;
spaceUsedBytes?: number;
spaceReservedBytes?: number;
spaceAvailableBytes?: number;
publishSlug?: string;
publishUrl?: string;
publishSkillName?: string;
@@ -96,6 +100,7 @@ export type LlmProviderKeyRow = {
goosedProviderId: string | null;
status: 'active' | 'disabled';
isSelected: boolean;
isVisionSelected: boolean;
apiKeyMasked: string;
createdAt: number;
updatedAt: number;
@@ -109,6 +114,14 @@ export type LlmGlobalSettings = {
availableModels: string[];
};
export type LlmVisionSettings = {
keyId: string | null;
keyName: string | null;
providerLabel: string | null;
visionModel: string | null;
availableModels: string[];
};
export type LlmConnectionTestResult = {
ok: boolean;
latencyMs?: number;
@@ -117,6 +130,82 @@ export type LlmConnectionTestResult = {
message?: string;
};
export type LlmExecutorId = 'goose' | 'aider' | 'openhands';
export type LlmExecutorBinding = {
id: string | null;
executor: LlmExecutorId;
executorLabel: string;
executorDescription: string;
purpose: string;
providerKeyId: string | null;
providerName: string | null;
providerLabel: string | null;
providerId: string | null;
model: string;
enabled: boolean;
availableModels: string[];
createdAt: number | null;
updatedAt: number | null;
};
export type LlmExecutorRuntime = {
ok: boolean;
executor: LlmExecutorId;
executorLabel?: string;
purpose?: string;
providerKeyId?: string;
providerName?: string;
providerKind?: string;
providerId?: string;
providerLabel?: string;
goosedProviderId?: string | null;
model?: string;
apiUrl?: string | null;
apiBaseUrl?: string;
apiKeyMasked?: string;
env?: Record<string, string>;
message?: string;
};
export type LlmExecutorLaunchPlan = {
ok: boolean;
executor: LlmExecutorId | null;
cwd?: string;
command?: string;
args?: string[];
env?: Record<string, string>;
notes?: string[];
message?: string;
};
export type LlmExecutorLaunchState = {
executor: LlmExecutorId;
purpose: string;
pid: number | null;
running: boolean;
command: string | null;
args: string[];
cwd: string | null;
logFile: string | null;
startedAt: number | null;
stoppedAt: number | null;
exitReason: string | null;
mode: string | null;
instruction: string | null;
};
export type AdminServiceRestartAction = 'local_restart' | 'pro_restart';
export type AdminServiceRestartResult = {
ok: boolean;
action: AdminServiceRestartAction;
message: string;
pid?: number | null;
output?: string;
logFile?: string | null;
};
export type UsageRecord = {
id: number;
userId: string;
@@ -142,6 +231,111 @@ export type LedgerEntry = {
createdAt: number;
};
export type WechatAdminSummary = {
config: {
mpEnabled: boolean;
scheduleEnabled: boolean;
reminderWorkerEnabled: boolean;
appId: string | null;
publicBaseUrl: string | null;
bindPath: string | null;
tokenEndpointConfigured: boolean;
customerServiceEndpointConfigured: boolean;
};
counts: {
boundUsers: number;
routes: { total: number; active: number };
recentMessages: Record<string, number>;
digests: Record<string, number>;
recentDeliveries: Record<string, number>;
};
};
export type MindSpaceAdminConfig = {
publicPageLimit: number;
};
export type WechatBinding = {
userId: string;
username: string;
displayName: string;
status: string;
appId: string | null;
openidMasked: string;
nickname: string | null;
avatarUrl: string | null;
lastLoginAt: number;
boundAt: number;
routeId: string | null;
routeStatus: string | null;
agentSessionId: string | null;
routeUpdatedAt: number | null;
};
export type WechatMessage = {
appId: string | null;
openidMasked: string;
msgId: string;
status: string;
agentSessionId: string | null;
createdAt: number;
updatedAt: number;
userId: string | null;
username: string | null;
displayName: string | null;
};
export type WechatDigestSubscription = {
id: string;
userId: string;
username: string;
displayName: string;
digestType: string;
hour: number;
minute: number;
timezone: string;
channel: string;
status: string;
nextRunAt: number;
lastRunAt: number | null;
attempts: number;
lastError: string | null;
sourceText: string | null;
createdAt: number;
updatedAt: number;
};
export type WechatDeliveryLog = {
id: string;
reminderId: string | null;
subscriptionId: string | null;
userId: string;
username: string;
displayName: string;
channel: string;
status: string;
providerMessageId: string | null;
errorCode: string | null;
errorMessage: string | null;
createdAt: number;
digestType: string | null;
};
export type WechatWebNotification = {
id: string;
userId: string;
username: string;
displayName: string;
channel: string;
notificationType: string;
title: string;
body: string;
status: string;
readAt: number | null;
createdAt: number;
updatedAt: number;
};
export type AdminDashboardSummary = {
users: {
total: number;
@@ -167,3 +361,54 @@ export type AdminDashboardSummary = {
globalModel: string | null;
} | null;
};
export type BlockedWord = {
id: string;
word: string;
replacement: string;
note: string | null;
status: 'active' | 'disabled';
created_at: number;
updated_at: number;
};
export type PlanDefinition = {
planType: string;
name: string;
priceCents: number;
periodDays: number;
periodTokens: number;
periodImages: number;
modelTier: string;
overageRate: number;
sortOrder: number;
isActive: boolean;
description: string | null;
};
export type PlanSyncResult = {
enabled: boolean;
ok: boolean;
message: string;
synced?: number;
total?: number;
failures?: string[];
};
export type AdminSubscription = {
id: string;
userId: string;
username: string;
displayName: string;
planType: string;
status: 'active' | 'expired' | 'cancelled';
startedAt: number;
expiresAt: number;
periodTokensLimit: number;
periodTokensUsed: number;
periodImagesLimit: number;
periodImagesUsed: number;
note: string | null;
createdAt: number;
};