-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathevents.ts
28 lines (27 loc) · 1.06 KB
/
events.ts
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
import type { Target } from '../target';
import type { ReadOnly } from '../readonly';
import type { PlanNode, PlanningStats } from '../planner';
import type { Action } from '../task';
export type AgentRuntimeEvent<TState = unknown> =
| {
event: 'start';
target: Target<TState>;
}
| {
event: 'find-plan';
state: ReadOnly<TState>;
target: Target<TState>;
}
| { event: 'plan-found'; start: PlanNode<TState>; stats: PlanningStats }
| { event: 'plan-not-found'; cause: unknown; stats: PlanningStats }
| { event: 'plan-timeout'; timeout: number }
| { event: 'backoff'; tries: number; delayMs: number }
| { event: 'success' }
| { event: 'failure'; cause: unknown }
| { event: 'plan-executed' }
// Actions can run in parallel so all these events need an action property
| { event: 'action-next'; action: Action<TState> }
| { event: 'action-condition-failed'; action: Action<TState> }
| { event: 'action-start'; action: Action<TState> }
| { event: 'action-failure'; action: Action<TState>; cause: unknown }
| { event: 'action-success'; action: Action<TState> };