@@ -9,13 +9,18 @@ export interface ChatMessage {
99 timestamp : number
1010}
1111
12+ export interface ActionHistoryLine {
13+ line : string
14+ timestamp : number
15+ }
16+
1217export interface BlackboardState {
1318 ultimateGoal : string
1419 currentTask : string
1520 strategy : string
1621 contextView : contextViewState
1722 chatHistory : ChatMessage [ ]
18- recentActionHistory : string [ ]
23+ recentActionHistory : ActionHistoryLine [ ]
1924 pendingActions : string [ ]
2025 selfUsername : string
2126}
@@ -49,7 +54,7 @@ export class Blackboard {
4954 public get selfSummary ( ) : string { return this . _state . contextView . selfSummary }
5055 public get environmentSummary ( ) : string { return this . _state . contextView . environmentSummary }
5156 public get chatHistory ( ) : ChatMessage [ ] { return this . _state . chatHistory }
52- public get recentActionHistory ( ) : string [ ] { return this . _state . recentActionHistory }
57+ public get recentActionHistory ( ) : ActionHistoryLine [ ] { return this . _state . recentActionHistory }
5358 public get pendingActions ( ) : string [ ] { return this . _state . pendingActions }
5459 public get selfUsername ( ) : string { return this . _state . selfUsername }
5560
@@ -70,8 +75,8 @@ export class Blackboard {
7075 this . _state = { ...this . _state , chatHistory : newHistory }
7176 }
7277
73- public addActionHistoryLine ( line : string ) : void {
74- const next = [ ...this . _state . recentActionHistory , line ]
78+ public addActionHistoryLine ( line : string , timestamp : number = Date . now ( ) ) : void {
79+ const next = [ ...this . _state . recentActionHistory , { line, timestamp } ]
7580 const trimmed = next . length > Blackboard . MAX_ACTION_HISTORY ? next . slice ( - Blackboard . MAX_ACTION_HISTORY ) : next
7681 this . _state = { ...this . _state , recentActionHistory : trimmed }
7782 }
@@ -86,7 +91,7 @@ export class Blackboard {
8691 ...this . _state ,
8792 contextView : { ...this . _state . contextView } ,
8893 chatHistory : [ ...this . _state . chatHistory ] ,
89- recentActionHistory : [ ... this . _state . recentActionHistory ] ,
94+ recentActionHistory : this . _state . recentActionHistory . map ( l => ( { ... l } ) ) ,
9095 pendingActions : [ ...this . _state . pendingActions ] ,
9196 }
9297 }
0 commit comments