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:
71
admin-v2/src/services/scheduled-tasks.ts
Normal file
71
admin-v2/src/services/scheduled-tasks.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
// ============================================================
|
||||
// 定时任务 — Service
|
||||
// ============================================================
|
||||
|
||||
import request, { withSignal } from './request'
|
||||
|
||||
// === Types ===
|
||||
|
||||
export interface TaskTarget {
|
||||
type: string // "agent" | "hand" | "workflow"
|
||||
id: string
|
||||
}
|
||||
|
||||
export interface ScheduledTask {
|
||||
id: string
|
||||
name: string
|
||||
schedule: string
|
||||
schedule_type: string // "cron" | "interval" | "once"
|
||||
target: TaskTarget
|
||||
enabled: boolean
|
||||
description: string | null
|
||||
last_run: string | null
|
||||
next_run: string | null
|
||||
run_count: number
|
||||
last_result: string | null
|
||||
last_error: string | null
|
||||
last_duration_ms: number | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface CreateScheduledTaskRequest {
|
||||
name: string
|
||||
schedule: string
|
||||
schedule_type?: string
|
||||
target: TaskTarget
|
||||
description?: string
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
export interface UpdateScheduledTaskRequest {
|
||||
name?: string
|
||||
schedule?: string
|
||||
schedule_type?: string
|
||||
target?: TaskTarget
|
||||
description?: string
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
// === Service ===
|
||||
|
||||
export const scheduledTaskService = {
|
||||
list: (signal?: AbortSignal) =>
|
||||
request.get<ScheduledTask[]>('/scheduler/tasks', withSignal({}, signal))
|
||||
.then((r) => r.data),
|
||||
|
||||
get: (id: string, signal?: AbortSignal) =>
|
||||
request.get<ScheduledTask>(`/scheduler/tasks/${id}`, withSignal({}, signal))
|
||||
.then((r) => r.data),
|
||||
|
||||
create: (data: CreateScheduledTaskRequest) =>
|
||||
request.post<ScheduledTask>('/scheduler/tasks', data)
|
||||
.then((r) => r.data),
|
||||
|
||||
update: (id: string, data: UpdateScheduledTaskRequest) =>
|
||||
request.patch<ScheduledTask>(`/scheduler/tasks/${id}`, data)
|
||||
.then((r) => r.data),
|
||||
|
||||
delete: (id: string) =>
|
||||
request.delete(`/scheduler/tasks/${id}`)
|
||||
.then((r) => r.data),
|
||||
}
|
||||
Reference in New Issue
Block a user