-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathgoal.ts
More file actions
44 lines (38 loc) · 1.17 KB
/
Copy pathgoal.ts
File metadata and controls
44 lines (38 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Goal domain model.
*
* A Goal is a persistent objective that drives autonomous agent work.
* Goals have lower priority than tasks — agents work on goals only
* when no regular tasks are available.
*
* State machine: active → achieved | abandoned | paused
* paused → active | achieved | abandoned
*/
export const GOAL_STATUSES = ['active', 'paused', 'achieved', 'abandoned'] as const;
export type GoalStatus = (typeof GOAL_STATUSES)[number];
/** Terminal goal statuses — no further transitions possible. */
export const TERMINAL_GOAL_STATUSES: ReadonlySet<GoalStatus> = new Set(['achieved', 'abandoned']);
export function isGoalTerminal(status: GoalStatus): boolean {
return TERMINAL_GOAL_STATUSES.has(status);
}
/** Canonical sort order for goal statuses. */
export const GOAL_STATUS_ORDER: Record<GoalStatus, number> = {
active: 0,
paused: 1,
achieved: 2,
abandoned: 3,
};
export interface Goal {
id: string;
title: string;
description: string;
status: GoalStatus;
assignee?: string;
created_at: string;
updated_at?: string;
}
export interface CreateGoalInput {
title: string;
description?: string;
assignee?: string;
}