fix(production-readiness): 3-batch production readiness cleanup — 12 tasks
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
Batch 1 — User-facing fixes: - B1-1: Pipeline verified end-to-end (14 Rust commands, 8 frontend invoke, fully connected) - B1-2: MessageSearch restored to ChatArea with search button in DeerFlow header - B1-3: Viking cleanup — removed 5 orphan invokes (no Rust impl), added addWithMetadata + storeWithSummaries methods + summary generation UI - B1-4: api-fallbacks transparency — added _isFallback markers + console.warn to all 6 fallback functions Batch 2 — System health: - B2-1: Document drift calibration — TRUTH.md/README.md numbers verified and updated - B2-2: @reserved annotations on 15 SaaS handler functions with no frontend callers - B2-3: Scheduled Task Admin V2 — new service + page + route + sidebar navigation - B2-4: TRUTH.md Pipeline/Viking/ScheduledTask records corrected Batch 3 — Long-term quality: - B3-1: hand_run_status/hand_run_list verified as fully implemented (not stubs) - B3-2: Identity snapshot rollback UI added to RightPanel - B3-3: P2 code quality — 4 fixes (TODO comments, fire-and-forget notes, design notes, table name validation), 2 verified N/A, 1 upstream - B3-4: Config PATCH→PUT alignment (admin-v2 config.ts matched to SaaS backend)
This commit is contained in:
@@ -69,6 +69,7 @@ export interface SecurityLayerFallback {
|
||||
}
|
||||
|
||||
export interface SecurityStatusFallback {
|
||||
_isFallback?: true;
|
||||
layers: SecurityLayerFallback[];
|
||||
enabledCount: number;
|
||||
totalCount: number;
|
||||
@@ -107,8 +108,10 @@ interface TriggerForTasks {
|
||||
* Default quick config when /api/config/quick returns 404.
|
||||
* Uses sensible defaults for a new user experience.
|
||||
*/
|
||||
export function getQuickConfigFallback(): QuickConfigFallback {
|
||||
export function getQuickConfigFallback(): QuickConfigFallback & { _isFallback: true } {
|
||||
console.warn('[fallback] 使用降级数据: getQuickConfigFallback');
|
||||
return {
|
||||
_isFallback: true as const,
|
||||
agentName: '默认助手',
|
||||
agentRole: 'AI 助手',
|
||||
userName: '用户',
|
||||
@@ -127,13 +130,15 @@ export function getQuickConfigFallback(): QuickConfigFallback {
|
||||
* Default workspace info when /api/workspace returns 404.
|
||||
* Returns a placeholder indicating workspace is not configured.
|
||||
*/
|
||||
export function getWorkspaceInfoFallback(): WorkspaceInfoFallback {
|
||||
export function getWorkspaceInfoFallback(): WorkspaceInfoFallback & { _isFallback: true } {
|
||||
console.warn('[fallback] 使用降级数据: getWorkspaceInfoFallback');
|
||||
// Try to get a reasonable default path
|
||||
const defaultPath = typeof window !== 'undefined'
|
||||
? `${navigator.userAgent.includes('Windows') ? 'C:\\Users' : '/home'}/workspace`
|
||||
: '/workspace';
|
||||
|
||||
return {
|
||||
_isFallback: true as const,
|
||||
path: defaultPath,
|
||||
resolvedPath: defaultPath,
|
||||
exists: false,
|
||||
@@ -145,7 +150,8 @@ export function getWorkspaceInfoFallback(): WorkspaceInfoFallback {
|
||||
/**
|
||||
* Calculate usage stats from session data when /api/stats/usage returns 404.
|
||||
*/
|
||||
export function getUsageStatsFallback(sessions: SessionForStats[] = []): UsageStatsFallback {
|
||||
export function getUsageStatsFallback(sessions: SessionForStats[] = []): UsageStatsFallback & { _isFallback: true } {
|
||||
console.warn('[fallback] 使用降级数据: getUsageStatsFallback — 基于本地 session 数据计算');
|
||||
const stats: UsageStatsFallback = {
|
||||
totalSessions: sessions.length,
|
||||
totalMessages: 0,
|
||||
@@ -173,14 +179,15 @@ export function getUsageStatsFallback(sessions: SessionForStats[] = []): UsageSt
|
||||
}
|
||||
}
|
||||
|
||||
return stats;
|
||||
return { ...stats, _isFallback: true as const };
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert skills to plugin status when /api/plugins/status returns 404.
|
||||
* ZCLAW uses Skills instead of traditional plugins.
|
||||
*/
|
||||
export function getPluginStatusFallback(skills: SkillForPlugins[] = []): PluginStatusFallback[] {
|
||||
export function getPluginStatusFallback(skills: SkillForPlugins[] = []): Array<PluginStatusFallback & { _isFallback?: true }> {
|
||||
console.warn('[fallback] 使用降级数据: getPluginStatusFallback — 从 Skills 列表推断');
|
||||
if (skills.length === 0) {
|
||||
// No skills loaded — return empty rather than fabricating fake builtins
|
||||
return [];
|
||||
@@ -197,7 +204,8 @@ export function getPluginStatusFallback(skills: SkillForPlugins[] = []): PluginS
|
||||
/**
|
||||
* Convert triggers to scheduled tasks when /api/scheduler/tasks returns 404.
|
||||
*/
|
||||
export function getScheduledTasksFallback(triggers: TriggerForTasks[] = []): ScheduledTaskFallback[] {
|
||||
export function getScheduledTasksFallback(triggers: TriggerForTasks[] = []): Array<ScheduledTaskFallback & { _isFallback?: true }> {
|
||||
console.warn('[fallback] 使用降级数据: getScheduledTasksFallback — 从 Triggers 列表推断');
|
||||
return triggers
|
||||
.filter((t) => t.enabled)
|
||||
.map((trigger) => ({
|
||||
@@ -214,7 +222,8 @@ export function getScheduledTasksFallback(triggers: TriggerForTasks[] = []): Sch
|
||||
* Returns honest minimal response — only includes layers that correspond
|
||||
* to real ZCLAW capabilities, no fabricated layers.
|
||||
*/
|
||||
export function getSecurityStatusFallback(): SecurityStatusFallback {
|
||||
export function getSecurityStatusFallback(): SecurityStatusFallback & { _isFallback: true } {
|
||||
console.warn('[fallback] 使用降级数据: getSecurityStatusFallback — 返回静态安全层状态');
|
||||
const layers: SecurityLayerFallback[] = [
|
||||
{ name: 'device_auth', enabled: true, description: '设备认证' },
|
||||
{ name: 'rbac', enabled: true, description: '角色权限控制' },
|
||||
@@ -228,6 +237,7 @@ export function getSecurityStatusFallback(): SecurityStatusFallback {
|
||||
const securityLevel = calculateSecurityLevel(enabledCount, layers.length);
|
||||
|
||||
return {
|
||||
_isFallback: true as const,
|
||||
layers,
|
||||
enabledCount,
|
||||
totalCount: layers.length,
|
||||
|
||||
@@ -65,13 +65,15 @@ export async function addVikingResource(
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a resource with inline content
|
||||
* Add a resource with metadata (keywords + importance)
|
||||
*/
|
||||
export async function addVikingResourceInline(
|
||||
export async function addVikingResourceWithMetadata(
|
||||
uri: string,
|
||||
content: string
|
||||
content: string,
|
||||
keywords: string[],
|
||||
importance?: number
|
||||
): Promise<VikingAddResult> {
|
||||
return invoke<VikingAddResult>('viking_add_inline', { uri, content });
|
||||
return invoke<VikingAddResult>('viking_add_with_metadata', { uri, content, keywords, importance });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,41 +138,16 @@ export async function getVikingTree(
|
||||
return invoke<Record<string, unknown>>('viking_tree', { path, depth });
|
||||
}
|
||||
|
||||
// === Server Functions ===
|
||||
|
||||
export interface VikingServerStatus {
|
||||
running: boolean;
|
||||
port?: number;
|
||||
pid?: number;
|
||||
error?: string;
|
||||
}
|
||||
// === Summary Generation Functions ===
|
||||
|
||||
/**
|
||||
* Get Viking server status
|
||||
* Store a resource and auto-generate L0/L1 summaries via configured LLM driver
|
||||
*/
|
||||
export async function getVikingServerStatus(): Promise<VikingServerStatus> {
|
||||
return invoke<VikingServerStatus>('viking_server_status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Viking server
|
||||
*/
|
||||
export async function startVikingServer(): Promise<void> {
|
||||
return invoke<void>('viking_server_start');
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop Viking server
|
||||
*/
|
||||
export async function stopVikingServer(): Promise<void> {
|
||||
return invoke<void>('viking_server_stop');
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart Viking server
|
||||
*/
|
||||
export async function restartVikingServer(): Promise<void> {
|
||||
return invoke<void>('viking_server_restart');
|
||||
export async function storeWithSummaries(
|
||||
uri: string,
|
||||
content: string
|
||||
): Promise<VikingAddResult> {
|
||||
return invoke<VikingAddResult>('viking_store_with_summaries', { uri, content });
|
||||
}
|
||||
|
||||
// === Memory Extraction Functions ===
|
||||
|
||||
Reference in New Issue
Block a user