fix: P0 panic风险修复 + P1编译warnings清零 + P2代码/文档清理
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
P0 安全性: - account/handlers.rs: .unwrap() → .expect() 语义化错误信息 - relay/handlers.rs: SSE Response .unwrap() → .expect() P1 编译质量 (6 warnings → 0): - kernel.rs: 移除未使用的 Capability import 和 config_clone 变量 - pipeline_commands.rs: 未使用变量 id → _id - db.rs: 移除多余括号 - relay/service.rs: 移除未使用的 StreamExt import - telemetry/service.rs: 抑制 param_idx 未读赋值警告 - main.rs: TcpKeepalive::with_retries() Linux-only 条件编译 P2 代码清理: - 移除 handStore/HandsPanel/HandTaskPanel/gateway-api/SchedulerPanel 调试 console.log - SchedulerPanel: 修复 updateWorkflow 未解构导致 TS 编译错误 - 文档清理 zclaw-channels 已移除 crate 的引用
This commit is contained in:
@@ -1341,7 +1341,7 @@ pub async fn pipeline_templates(
|
||||
// Filter pipelines that have `is_template: true` in metadata
|
||||
// or are in the _templates directory
|
||||
let templates: Vec<PipelineTemplateInfo> = pipelines.iter()
|
||||
.filter_map(|(id, pipeline)| {
|
||||
.filter_map(|(_id, pipeline)| {
|
||||
// Check if this pipeline has template metadata
|
||||
let is_template = pipeline.metadata.annotations
|
||||
.as_ref()
|
||||
|
||||
@@ -93,11 +93,9 @@ export function HandTaskPanel({ handId, onBack }: HandTaskPanelProps) {
|
||||
}
|
||||
|
||||
setIsActivating(true);
|
||||
console.log(`[HandTaskPanel] Activating hand: ${selectedHand.id} (${selectedHand.name})`);
|
||||
|
||||
try {
|
||||
const result = await triggerHand(selectedHand.id);
|
||||
console.log(`[HandTaskPanel] Activation result:`, result);
|
||||
|
||||
if (result) {
|
||||
toast(`Hand "${selectedHand.name}" 已成功启动`, 'success');
|
||||
|
||||
@@ -475,11 +475,9 @@ export function HandsPanel() {
|
||||
|
||||
const handleActivate = useCallback(async (hand: Hand, params?: Record<string, unknown>) => {
|
||||
setActivatingHandId(hand.id);
|
||||
console.log(`[HandsPanel] Activating hand: ${hand.id} (${hand.name})`, params ? 'with params:' : '', params);
|
||||
|
||||
try {
|
||||
const result = await triggerHand(hand.id, params);
|
||||
console.log(`[HandsPanel] Hand activation result:`, result);
|
||||
|
||||
if (result) {
|
||||
toast(`Hand "${hand.name}" 已成功激活`, 'success');
|
||||
|
||||
@@ -653,6 +653,7 @@ export function SchedulerPanel() {
|
||||
const workflows = useWorkflowStore((s) => s.workflows);
|
||||
const loadWorkflows = useWorkflowStore((s) => s.loadWorkflows);
|
||||
const createWorkflow = useWorkflowStore((s) => s.createWorkflow);
|
||||
const updateWorkflow = useWorkflowStore((s) => s.updateWorkflow);
|
||||
const executeWorkflow = useWorkflowStore((s) => s.triggerWorkflow);
|
||||
const handLoading = useHandStore((s) => s.isLoading);
|
||||
const workflowLoading = useWorkflowStore((s) => s.isLoading);
|
||||
@@ -707,7 +708,7 @@ export function SchedulerPanel() {
|
||||
try {
|
||||
if (editingWorkflow) {
|
||||
// Update existing workflow
|
||||
console.log('Update workflow:', editingWorkflow.id, data);
|
||||
await updateWorkflow(editingWorkflow.id, data);
|
||||
} else {
|
||||
// Create new workflow
|
||||
await createWorkflow(data);
|
||||
@@ -721,7 +722,7 @@ export function SchedulerPanel() {
|
||||
} finally {
|
||||
setIsSavingWorkflow(false);
|
||||
}
|
||||
}, [editingWorkflow, createWorkflow, loadWorkflows]);
|
||||
}, [editingWorkflow, createWorkflow, updateWorkflow, loadWorkflows]);
|
||||
|
||||
const handleExecuteWorkflow = useCallback(async (workflowId: string) => {
|
||||
try {
|
||||
|
||||
@@ -374,13 +374,11 @@ export function installApiMethods(ClientClass: { prototype: GatewayClient }): vo
|
||||
};
|
||||
|
||||
proto.triggerHand = async function (this: GatewayClient, name: string, params?: Record<string, unknown>): Promise<{ runId: string; status: string }> {
|
||||
console.log(`[GatewayClient] Triggering hand: ${name}`, params);
|
||||
try {
|
||||
const result = await this.restPost<{
|
||||
instance_id: string;
|
||||
status: string;
|
||||
}>(`/api/hands/${name}/activate`, params || {});
|
||||
console.log(`[GatewayClient] Hand trigger response:`, result);
|
||||
return { runId: result.instance_id, status: result.status };
|
||||
} catch (err) {
|
||||
console.error(`[GatewayClient] Hand trigger failed for ${name}:`, err);
|
||||
|
||||
@@ -212,17 +212,11 @@ export const useHandStore = create<HandStore>((set, get) => ({
|
||||
|
||||
loadHands: async () => {
|
||||
const client = get().client;
|
||||
console.log('[HandStore] loadHands called, client:', !!client);
|
||||
if (!client) {
|
||||
console.warn('[HandStore] No client available, skipping loadHands');
|
||||
return;
|
||||
}
|
||||
if (!client) return;
|
||||
|
||||
set({ isLoading: true });
|
||||
try {
|
||||
console.log('[HandStore] Calling client.listHands()...');
|
||||
const result = await client.listHands();
|
||||
console.log('[HandStore] listHands result:', result);
|
||||
const validStatuses = ['idle', 'running', 'needs_approval', 'error', 'unavailable', 'setup_needed'] as const;
|
||||
const hands: Hand[] = (result?.hands || []).map((h: Record<string, unknown>) => {
|
||||
const status = validStatuses.includes(h.status as Hand['status'])
|
||||
@@ -240,7 +234,6 @@ export const useHandStore = create<HandStore>((set, get) => ({
|
||||
metricCount: (h.metric_count as number) || ((h.metrics as unknown[])?.length),
|
||||
};
|
||||
});
|
||||
console.log('[HandStore] Mapped hands:', hands.length, 'items');
|
||||
set({ hands, isLoading: false });
|
||||
} catch (err) {
|
||||
console.error('[HandStore] loadHands error:', err);
|
||||
|
||||
Reference in New Issue
Block a user