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 all 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.

46 changes: 46 additions & 0 deletions client/src/app/core/models/schedule.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ export type ScheduleActionType =
| 'improvement_loop'
| 'memory_maintenance'
| 'reputation_attestation'
| 'outcome_analysis'
| 'daily_review'
| 'status_checkin'
| 'marketplace_billing'
| 'flock_testing'
| 'flock_reputation_refresh'
| 'evaluate_established'
| 'discord_post'
| 'github_comment_monitor'
| 'activity_summary'
| 'custom';

export type ScheduleApprovalPolicy = 'auto' | 'owner_approve' | 'council_approve';
Expand All @@ -36,6 +46,28 @@ export interface ScheduleAction {
prompt?: string;
maxImprovementTasks?: number;
focusArea?: string;
channelId?: string;
embedTitle?: string;
embedColor?: number;
}

export type ScheduleExecutionMode = 'independent' | 'pipeline';

export type PipelineStepCondition = 'always' | 'on_success' | 'on_failure';

export interface PipelineStep {
label: string;
action: ScheduleAction;
condition?: PipelineStepCondition;
}

export type ScheduleOutputDestinationType = 'discord_channel' | 'algochat_agent' | 'algochat_address';
export type ScheduleOutputFormat = 'summary' | 'full' | 'on_error_only';

export interface ScheduleOutputDestination {
type: ScheduleOutputDestinationType;
target: string;
format?: ScheduleOutputFormat;
}

export interface AgentSchedule {
Expand All @@ -51,7 +83,11 @@ export interface AgentSchedule {
maxExecutions: number | null;
executionCount: number;
maxBudgetPerRun: number | null;
notifyAddress: string | null;
triggerEvents: ScheduleTriggerEvent[] | null;
outputDestinations: ScheduleOutputDestination[] | null;
executionMode: ScheduleExecutionMode;
pipelineSteps: PipelineStep[] | null;
lastRunAt: string | null;
nextRunAt: string | null;
createdAt: string;
Expand All @@ -71,6 +107,7 @@ export interface ScheduleExecution {
sessionId: string | null;
workTaskId: string | null;
costUsd: number;
configSnapshot?: Record<string, unknown>;
startedAt: string;
completedAt: string | null;
}
Expand All @@ -85,10 +122,15 @@ export interface CreateScheduleInput {
approvalPolicy?: ScheduleApprovalPolicy;
maxExecutions?: number;
maxBudgetPerRun?: number;
notifyAddress?: string;
triggerEvents?: ScheduleTriggerEvent[];
outputDestinations?: ScheduleOutputDestination[];
executionMode?: ScheduleExecutionMode;
pipelineSteps?: PipelineStep[];
}

export interface UpdateScheduleInput {
agentId?: string;
name?: string;
description?: string;
cronExpression?: string;
Expand All @@ -98,5 +140,9 @@ export interface UpdateScheduleInput {
status?: ScheduleStatus;
maxExecutions?: number;
maxBudgetPerRun?: number;
notifyAddress?: string | null;
triggerEvents?: ScheduleTriggerEvent[] | null;
outputDestinations?: ScheduleOutputDestination[] | null;
executionMode?: ScheduleExecutionMode;
pipelineSteps?: PipelineStep[] | null;
}
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