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
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:
@@ -52,14 +52,14 @@ pub(crate) struct ProcessLogsResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get ZCLAW Kernel status
|
/// Get ZCLAW Kernel status
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn zclaw_status(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
pub fn zclaw_status(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
||||||
read_gateway_status(&app)
|
read_gateway_status(&app)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start ZCLAW Kernel
|
/// Start ZCLAW Kernel
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn zclaw_start(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
pub fn zclaw_start(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
||||||
ensure_local_gateway_ready_for_tauri(&app)?;
|
ensure_local_gateway_ready_for_tauri(&app)?;
|
||||||
@@ -69,7 +69,7 @@ pub fn zclaw_start(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Stop ZCLAW Kernel
|
/// Stop ZCLAW Kernel
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn zclaw_stop(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
pub fn zclaw_stop(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
||||||
run_zclaw(&app, &["gateway", "stop", "--json"])?;
|
run_zclaw(&app, &["gateway", "stop", "--json"])?;
|
||||||
@@ -78,7 +78,7 @@ pub fn zclaw_stop(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Restart ZCLAW Kernel
|
/// Restart ZCLAW Kernel
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn zclaw_restart(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
pub fn zclaw_restart(app: AppHandle) -> Result<LocalGatewayStatus, String> {
|
||||||
ensure_local_gateway_ready_for_tauri(&app)?;
|
ensure_local_gateway_ready_for_tauri(&app)?;
|
||||||
@@ -114,7 +114,7 @@ pub fn zclaw_approve_device_pairing(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Run ZCLAW doctor to diagnose issues
|
/// Run ZCLAW doctor to diagnose issues
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn zclaw_doctor(app: AppHandle) -> Result<String, String> {
|
pub fn zclaw_doctor(app: AppHandle) -> Result<String, String> {
|
||||||
let result = run_zclaw(&app, &["doctor", "--json"])?;
|
let result = run_zclaw(&app, &["doctor", "--json"])?;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ pub struct ScheduledTaskResponse {
|
|||||||
///
|
///
|
||||||
/// Tasks are automatically executed by the SchedulerService which checks
|
/// Tasks are automatically executed by the SchedulerService which checks
|
||||||
/// every 60 seconds for due triggers.
|
/// every 60 seconds for due triggers.
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn scheduled_task_create(
|
pub async fn scheduled_task_create(
|
||||||
state: State<'_, KernelState>,
|
state: State<'_, KernelState>,
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ pub async fn trigger_delete(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a trigger manually
|
/// Execute a trigger manually
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn trigger_execute(
|
pub async fn trigger_execute(
|
||||||
state: State<'_, KernelState>,
|
state: State<'_, KernelState>,
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ pub async fn viking_add(uri: String, content: String) -> Result<VikingAddResult,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add a memory with metadata
|
/// Add a memory with metadata
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn viking_add_with_metadata(
|
pub async fn viking_add_with_metadata(
|
||||||
uri: String,
|
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
|
/// Store a memory and optionally generate L0/L1 summaries in the background
|
||||||
// @reserved: 暂无前端集成
|
// @connected
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn viking_store_with_summaries(
|
pub async fn viking_store_with_summaries(
|
||||||
uri: String,
|
uri: String,
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
import type {
|
import type {
|
||||||
BillingPlan,
|
BillingPlan,
|
||||||
SubscriptionInfo,
|
SubscriptionInfo,
|
||||||
UsageQuota,
|
|
||||||
CreatePaymentRequest,
|
CreatePaymentRequest,
|
||||||
PaymentResult,
|
PaymentResult,
|
||||||
PaymentStatus,
|
PaymentStatus,
|
||||||
@@ -80,14 +79,6 @@ export function installBillingMethods(ClientClass: { prototype: any }): void {
|
|||||||
return this.request<BillingPlan[]>('GET', '/api/v1/billing/plans');
|
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 ---
|
// --- Subscription ---
|
||||||
|
|
||||||
/** Get current subscription info (plan + subscription + usage) */
|
/** 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');
|
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 ---
|
// --- Payments ---
|
||||||
|
|
||||||
/** Create a payment order for a plan upgrade */
|
/** Create a payment order for a plan upgrade */
|
||||||
|
|||||||
@@ -89,17 +89,12 @@ import type {
|
|||||||
TotpResultResponse,
|
TotpResultResponse,
|
||||||
SaaSModelInfo,
|
SaaSModelInfo,
|
||||||
SaaSConfigItem,
|
SaaSConfigItem,
|
||||||
DeviceInfo,
|
|
||||||
SyncConfigRequest,
|
SyncConfigRequest,
|
||||||
ConfigDiffResponse,
|
ConfigDiffResponse,
|
||||||
ConfigSyncResult,
|
ConfigSyncResult,
|
||||||
SaaSErrorResponse,
|
SaaSErrorResponse,
|
||||||
RelayTaskInfo,
|
RelayTaskInfo,
|
||||||
UsageStats,
|
|
||||||
PromptCheckResult,
|
PromptCheckResult,
|
||||||
PromptTemplateInfo,
|
|
||||||
PromptVersionInfo,
|
|
||||||
PaginatedResponse,
|
|
||||||
AgentTemplateAvailable,
|
AgentTemplateAvailable,
|
||||||
AgentTemplateFull,
|
AgentTemplateFull,
|
||||||
AgentConfigFromTemplate,
|
AgentConfigFromTemplate,
|
||||||
@@ -310,21 +305,6 @@ export class SaaSClient {
|
|||||||
throw new SaaSApiError(0, 'UNKNOWN', '请求失败');
|
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 ---
|
// --- 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 ---
|
// --- Model Endpoints ---
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -490,17 +462,11 @@ export interface SaaSClient {
|
|||||||
|
|
||||||
// --- Relay (saas-relay.ts) ---
|
// --- Relay (saas-relay.ts) ---
|
||||||
listRelayTasks(query?: { status?: string; page?: number; page_size?: number }): Promise<RelayTaskInfo[]>;
|
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 }>;
|
retryRelayTask(taskId: string): Promise<{ ok: boolean; task_id: string }>;
|
||||||
chatCompletion(body: unknown, signal?: AbortSignal): Promise<Response>;
|
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) ---
|
// --- Prompt OTA (saas-prompt.ts) ---
|
||||||
checkPromptUpdates(deviceId: string, currentVersions: Record<string, number>): Promise<PromptCheckResult>;
|
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) ---
|
// --- Telemetry (saas-telemetry.ts) ---
|
||||||
reportTelemetry(data: {
|
reportTelemetry(data: {
|
||||||
@@ -531,9 +497,7 @@ export interface SaaSClient {
|
|||||||
incrementUsageDimension(dimension: string, count?: number): Promise<import('./saas-billing').UsageIncrementResult>;
|
incrementUsageDimension(dimension: string, count?: number): Promise<import('./saas-billing').UsageIncrementResult>;
|
||||||
reportUsageFireAndForget(dimension: string, count?: number): void;
|
reportUsageFireAndForget(dimension: string, count?: number): void;
|
||||||
listPlans(): Promise<import('./saas-types').BillingPlan[]>;
|
listPlans(): Promise<import('./saas-types').BillingPlan[]>;
|
||||||
getPlan(planId: string): Promise<import('./saas-types').BillingPlan>;
|
|
||||||
getSubscription(): Promise<import('./saas-types').SubscriptionInfo>;
|
getSubscription(): Promise<import('./saas-types').SubscriptionInfo>;
|
||||||
getUsage(): Promise<import('./saas-types').UsageQuota>;
|
|
||||||
createPayment(data: import('./saas-types').CreatePaymentRequest): Promise<import('./saas-types').PaymentResult>;
|
createPayment(data: import('./saas-types').CreatePaymentRequest): Promise<import('./saas-types').PaymentResult>;
|
||||||
getPaymentStatus(paymentId: string): Promise<import('./saas-types').PaymentStatus>;
|
getPaymentStatus(paymentId: string): Promise<import('./saas-types').PaymentStatus>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
|
|
||||||
import type {
|
import type {
|
||||||
PromptCheckResult,
|
PromptCheckResult,
|
||||||
PromptTemplateInfo,
|
|
||||||
PromptVersionInfo,
|
|
||||||
PaginatedResponse,
|
|
||||||
} from './saas-types';
|
} from './saas-types';
|
||||||
|
|
||||||
export function installPromptMethods(ClientClass: { prototype: any }): void {
|
export function installPromptMethods(ClientClass: { prototype: any }): void {
|
||||||
@@ -22,25 +19,4 @@ export function installPromptMethods(ClientClass: { prototype: any }): void {
|
|||||||
versions: currentVersions,
|
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}`);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
import type {
|
import type {
|
||||||
RelayTaskInfo,
|
RelayTaskInfo,
|
||||||
UsageStats,
|
|
||||||
} from './saas-types';
|
} from './saas-types';
|
||||||
import { createLogger } from './logger';
|
import { createLogger } from './logger';
|
||||||
const logger = createLogger('SaaSRelay');
|
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 : ''}`);
|
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) */
|
/** 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 }> {
|
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`);
|
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');
|
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 : ''}`);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user