Files
zclaw_openfang/src/core/proactive/proactive.ts
iven 045e9cef5b feat: initialize ZCLAW project with core systems and Tauri desktop
- Created backend core systems:
  - Remote Execution System (远程执行系统)
  - Task Orchestration Engine (任务编排引擎)
  - Persistent Memory System (持续记忆系统)
  - Proactive Service System (主动服务系统)

- Created Tauri desktop app:
  - Three-column layout based on AutoClaw design
  - React + TypeScript + Tailwind CSS
  - Zustand state management
  - Lucide React icons

- Components:
  - Sidebar (Agent list, IM channels, scheduled tasks)
  - ChatArea (Chat interface with message bubbles)
  - RightPanel (Task progress, statistics, next actions)

Next: Test Tauri dev server and integrate with OpenClaw backend
2026-03-11 22:06:07 +08:00

50 lines
1.1 KiB
TypeScript

// 主动服务系统
export interface ScheduledTask {
id: string;
userId: string;
channel: string;
schedule: {
type: 'once' | 'daily' | 'weekly' | 'cron';
time: string;
timezone: string;
};
task: {
type: string;
prompt: string;
};
status: 'active' | 'paused' | 'completed';
lastRun?: Date;
nextRun?: Date;
}
export class ProactiveServiceSystem {
private tasks: Map<string, ScheduledTask> = new Map();
private cronJobs: Map<string, any> = new Map();
async scheduleTask(task: ScheduledTask): Promise<void> {
task.id = task.id || this.generateId();
task.status = 'active';
this.tasks.set(task.id, task);
// TODO: 使用 node-cron 设置定时任务(后续实现)
console.log([Proactive] Task scheduled: );
}
async cancelTask(taskId: string): Promise<void> {
const task = this.tasks.get(taskId);
if (task) {
task.status = 'paused';
// TODO: 取消 cron job
}
}
async listTasks(userId: string): Promise<ScheduledTask[]> {
return Array.from(this.tasks.values()).filter(t => t.userId === userId);
}
private generateId(): string {
return cron__;
}
}