Skip to content
This repository was archived by the owner on Jul 2, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.13/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
Expand Down
202 changes: 108 additions & 94 deletions bun.lock

Large diffs are not rendered by default.

28 changes: 6 additions & 22 deletions client/src/app/core/services/schedule.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export class ScheduleService {

readonly schedules = signal<AgentSchedule[]>([]);
readonly executions = signal<ScheduleExecution[]>([]);
readonly pendingApprovals = signal<ScheduleExecution[]>([]);
readonly loading = signal(false);

private unsubscribeWs: (() => void) | null = null;
Expand All @@ -27,41 +26,27 @@ export class ScheduleService {

this.unsubscribeWs = this.ws.onMessage((msg: ServerWsMessage) => {
if (msg.type === 'schedule_update') {
const schedule = msg.schedule as AgentSchedule;
this.schedules.update((list) => {
const idx = list.findIndex((s) => s.id === schedule.id);
const idx = list.findIndex((s) => s.id === msg.schedule.id);
if (idx >= 0) {
const copy = [...list];
copy[idx] = schedule;
copy[idx] = msg.schedule;
return copy;
}
return [schedule, ...list];
return [msg.schedule, ...list];
});
}

if (msg.type === 'schedule_execution_update') {
const execution = msg.execution as ScheduleExecution;
this.executions.update((list) => {
const idx = list.findIndex((e) => e.id === execution.id);
const idx = list.findIndex((e) => e.id === msg.execution.id);
if (idx >= 0) {
const copy = [...list];
copy[idx] = execution;
copy[idx] = msg.execution;
return copy;
}
return [execution, ...list];
return [msg.execution, ...list];
});

// Track pending approvals
if (execution.status === 'awaiting_approval') {
this.pendingApprovals.update((list) => {
if (list.some((e) => e.id === execution.id)) return list;
return [execution, ...list];
});
} else {
this.pendingApprovals.update((list) =>
list.filter((e) => e.id !== execution.id),
);
}
}
});
}
Expand Down Expand Up @@ -134,7 +119,6 @@ export class ScheduleService {
const execution = await firstValueFrom(
this.api.post<ScheduleExecution>(`/schedule-executions/${executionId}/resolve`, { approved }),
);
this.pendingApprovals.update((list) => list.filter((e) => e.id !== executionId));
return execution;
}

Expand Down
Loading
Loading