fix(tauri): update @reserved annotations + remove dead SaaS client methods
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

- Update 9 @reserved → @connected for commands with frontend consumers:
  zclaw_status, zclaw_start, zclaw_stop, zclaw_restart, zclaw_doctor,
  viking_add_with_metadata, viking_store_with_summaries,
  trigger_execute, scheduled_task_create
- Remove 10 dead SaaS client methods with zero callers:
  healthCheck, listDevices (saas-client.ts)
  getRelayTask, getUsage/relay (saas-relay.ts)
  listPrompts, getPrompt, listPromptVersions, getPromptVersion (saas-prompt.ts)
  getPlan, getUsage/billing (saas-billing.ts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-05 00:22:45 +08:00
parent ac24d15bab
commit f846f3d632
8 changed files with 9 additions and 105 deletions

View File

@@ -52,14 +52,14 @@ pub(crate) struct ProcessLogsResponse {
}
/// Get ZCLAW Kernel status
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub fn zclaw_status(app: AppHandle) -> Result<LocalGatewayStatus, String> {
read_gateway_status(&app)
}
/// Start ZCLAW Kernel
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub fn zclaw_start(app: AppHandle) -> Result<LocalGatewayStatus, String> {
ensure_local_gateway_ready_for_tauri(&app)?;
@@ -69,7 +69,7 @@ pub fn zclaw_start(app: AppHandle) -> Result<LocalGatewayStatus, String> {
}
/// Stop ZCLAW Kernel
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub fn zclaw_stop(app: AppHandle) -> Result<LocalGatewayStatus, String> {
run_zclaw(&app, &["gateway", "stop", "--json"])?;
@@ -78,7 +78,7 @@ pub fn zclaw_stop(app: AppHandle) -> Result<LocalGatewayStatus, String> {
}
/// Restart ZCLAW Kernel
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub fn zclaw_restart(app: AppHandle) -> Result<LocalGatewayStatus, String> {
ensure_local_gateway_ready_for_tauri(&app)?;
@@ -114,7 +114,7 @@ pub fn zclaw_approve_device_pairing(
}
/// Run ZCLAW doctor to diagnose issues
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub fn zclaw_doctor(app: AppHandle) -> Result<String, String> {
let result = run_zclaw(&app, &["doctor", "--json"])?;

View File

@@ -47,7 +47,7 @@ pub struct ScheduledTaskResponse {
///
/// Tasks are automatically executed by the SchedulerService which checks
/// every 60 seconds for due triggers.
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub async fn scheduled_task_create(
state: State<'_, KernelState>,

View File

@@ -227,7 +227,7 @@ pub async fn trigger_delete(
}
/// Execute a trigger manually
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub async fn trigger_execute(
state: State<'_, KernelState>,

View File

@@ -182,7 +182,7 @@ pub async fn viking_add(uri: String, content: String) -> Result<VikingAddResult,
}
/// Add a memory with metadata
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub async fn viking_add_with_metadata(
uri: String,
@@ -616,7 +616,7 @@ pub async fn viking_configure_summary_driver(
}
/// Store a memory and optionally generate L0/L1 summaries in the background
// @reserved: 暂无前端集成
// @connected
#[tauri::command]
pub async fn viking_store_with_summaries(
uri: String,

View File

@@ -9,7 +9,6 @@
import type {
BillingPlan,
SubscriptionInfo,
UsageQuota,
CreatePaymentRequest,
PaymentResult,
PaymentStatus,
@@ -80,14 +79,6 @@ export function installBillingMethods(ClientClass: { prototype: any }): void {
return this.request<BillingPlan[]>('GET', '/api/v1/billing/plans');
};
/** Get a single plan by ID */
proto.getPlan = async function (
this: { request: RequestFn },
planId: string,
): Promise<BillingPlan> {
return this.request<BillingPlan>('GET', `/api/v1/billing/plans/${planId}`);
};
// --- Subscription ---
/** Get current subscription info (plan + subscription + usage) */
@@ -97,15 +88,6 @@ export function installBillingMethods(ClientClass: { prototype: any }): void {
return this.request<SubscriptionInfo>('GET', '/api/v1/billing/subscription');
};
// --- Usage ---
/** Get current month's usage quota */
proto.getUsage = async function (
this: { request: RequestFn },
): Promise<UsageQuota> {
return this.request<UsageQuota>('GET', '/api/v1/billing/usage');
};
// --- Payments ---
/** Create a payment order for a plan upgrade */

View File

@@ -89,17 +89,12 @@ import type {
TotpResultResponse,
SaaSModelInfo,
SaaSConfigItem,
DeviceInfo,
SyncConfigRequest,
ConfigDiffResponse,
ConfigSyncResult,
SaaSErrorResponse,
RelayTaskInfo,
UsageStats,
PromptCheckResult,
PromptTemplateInfo,
PromptVersionInfo,
PaginatedResponse,
AgentTemplateAvailable,
AgentTemplateFull,
AgentConfigFromTemplate,
@@ -310,21 +305,6 @@ export class SaaSClient {
throw new SaaSApiError(0, 'UNKNOWN', '请求失败');
}
// --- Health ---
/**
* Quick connectivity check against the SaaS backend.
*/
async healthCheck(): Promise<boolean> {
try {
await this.request<unknown>('GET', '/api/health', undefined, 5000);
return true;
} catch (e) {
saasLog.debug('Health check failed', { error: e });
return false;
}
}
// --- Device Endpoints ---
/**
@@ -353,14 +333,6 @@ export class SaaSClient {
});
}
/**
* List devices registered for the current account.
*/
async listDevices(): Promise<DeviceInfo[]> {
const res = await this.request<{ items: DeviceInfo[] }>('GET', '/api/v1/devices');
return res.items;
}
// --- Model Endpoints ---
/**
@@ -490,17 +462,11 @@ export interface SaaSClient {
// --- Relay (saas-relay.ts) ---
listRelayTasks(query?: { status?: string; page?: number; page_size?: number }): Promise<RelayTaskInfo[]>;
getRelayTask(taskId: string): Promise<RelayTaskInfo>;
retryRelayTask(taskId: string): Promise<{ ok: boolean; task_id: string }>;
chatCompletion(body: unknown, signal?: AbortSignal): Promise<Response>;
getUsage(params?: { from?: string; to?: string; provider_id?: string; model_id?: string }): Promise<UsageStats>;
// --- Prompt OTA (saas-prompt.ts) ---
checkPromptUpdates(deviceId: string, currentVersions: Record<string, number>): Promise<PromptCheckResult>;
listPrompts(params?: { category?: string; source?: string; status?: string; page?: number; page_size?: number }): Promise<PaginatedResponse<PromptTemplateInfo>>;
getPrompt(name: string): Promise<PromptTemplateInfo>;
listPromptVersions(name: string): Promise<PromptVersionInfo[]>;
getPromptVersion(name: string, version: number): Promise<PromptVersionInfo>;
// --- Telemetry (saas-telemetry.ts) ---
reportTelemetry(data: {
@@ -531,9 +497,7 @@ export interface SaaSClient {
incrementUsageDimension(dimension: string, count?: number): Promise<import('./saas-billing').UsageIncrementResult>;
reportUsageFireAndForget(dimension: string, count?: number): void;
listPlans(): Promise<import('./saas-types').BillingPlan[]>;
getPlan(planId: string): Promise<import('./saas-types').BillingPlan>;
getSubscription(): Promise<import('./saas-types').SubscriptionInfo>;
getUsage(): Promise<import('./saas-types').UsageQuota>;
createPayment(data: import('./saas-types').CreatePaymentRequest): Promise<import('./saas-types').PaymentResult>;
getPaymentStatus(paymentId: string): Promise<import('./saas-types').PaymentStatus>;
}

View File

@@ -7,9 +7,6 @@
import type {
PromptCheckResult,
PromptTemplateInfo,
PromptVersionInfo,
PaginatedResponse,
} from './saas-types';
export function installPromptMethods(ClientClass: { prototype: any }): void {
@@ -22,25 +19,4 @@ export function installPromptMethods(ClientClass: { prototype: any }): void {
versions: currentVersions,
});
};
/** List all prompt templates */
proto.listPrompts = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, params?: { category?: string; source?: string; status?: string; page?: number; page_size?: number }): Promise<PaginatedResponse<PromptTemplateInfo>> {
const qs = params ? '?' + new URLSearchParams(params as Record<string, string>).toString() : '';
return this.request<PaginatedResponse<PromptTemplateInfo>>('GET', `/api/v1/prompts${qs}`);
};
/** Get prompt template by name */
proto.getPrompt = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, name: string): Promise<PromptTemplateInfo> {
return this.request<PromptTemplateInfo>('GET', `/api/v1/prompts/${encodeURIComponent(name)}`);
};
/** List prompt versions */
proto.listPromptVersions = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, name: string): Promise<PromptVersionInfo[]> {
return this.request<PromptVersionInfo[]>('GET', `/api/v1/prompts/${encodeURIComponent(name)}/versions`);
};
/** Get specific prompt version */
proto.getPromptVersion = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, name: string, version: number): Promise<PromptVersionInfo> {
return this.request<PromptVersionInfo>('GET', `/api/v1/prompts/${encodeURIComponent(name)}/versions/${version}`);
};
}

View File

@@ -7,7 +7,6 @@
import type {
RelayTaskInfo,
UsageStats,
} from './saas-types';
import { createLogger } from './logger';
const logger = createLogger('SaaSRelay');
@@ -27,11 +26,6 @@ export function installRelayMethods(ClientClass: { prototype: any }): void {
return this.request<RelayTaskInfo[]>('GET', `/api/v1/relay/tasks${qs ? '?' + qs : ''}`);
};
/** Get a single relay task */
proto.getRelayTask = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, taskId: string): Promise<RelayTaskInfo> {
return this.request<RelayTaskInfo>('GET', `/api/v1/relay/tasks/${taskId}`);
};
/** Retry a failed relay task (admin only) */
proto.retryRelayTask = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, taskId: string): Promise<{ ok: boolean; task_id: string }> {
return this.request<{ ok: boolean; task_id: string }>('POST', `/api/v1/relay/tasks/${taskId}/retry`);
@@ -117,16 +111,4 @@ export function installRelayMethods(ClientClass: { prototype: any }): void {
throw new Error('chatCompletion: all attempts exhausted');
};
// --- Usage Statistics ---
/** Get usage statistics for current account */
proto.getUsage = async function (this: { request<T>(method: string, path: string, body?: unknown): Promise<T> }, params?: { from?: string; to?: string; provider_id?: string; model_id?: string }): Promise<UsageStats> {
const qs = new URLSearchParams();
if (params?.from) qs.set('from', params.from);
if (params?.to) qs.set('to', params.to);
if (params?.provider_id) qs.set('provider_id', params.provider_id);
if (params?.model_id) qs.set('model_id', params.model_id);
const query = qs.toString();
return this.request<UsageStats>('GET', `/api/v1/usage${query ? '?' + query : ''}`);
};
}