11import {
2- resolveMessageFrequency ,
32 TOOL_DISPLAY_CONFIG ,
43 type MessageFrequency ,
5- } from "@/config" ;
6- import type { ActiveRequest , TrackedTodo } from "@/config/local/sessions" ;
4+ } from "@/config/web" ;
75import type { SessionMessageState } from "./session-inspector" ;
86
7+ export type StatusRequest = {
8+ channelId : string ;
9+ threadId : string ;
10+ statusMessageTs : string ;
11+ startedAt : number ;
12+ currentText : string ;
13+ statusFrozen ?: boolean ;
14+ } ;
15+
16+ type StatusTodo = {
17+ content : string ;
18+ status : string ;
19+ } ;
20+
921const PLAN_TODO_LIMIT = 15 ;
1022
1123export function formatElapsedTime ( startedAt : number ) : string {
@@ -40,7 +52,7 @@ export function getTodoIcon(status: string): string {
4052 }
4153}
4254
43- export function getStatusMessageKey ( request : ActiveRequest ) : string {
55+ export function getStatusMessageKey ( request : StatusRequest ) : string {
4456 return `${ request . channelId } :${ request . threadId } :${ request . statusMessageTs } ` ;
4557}
4658
@@ -74,7 +86,7 @@ export function trimToolPath(label: string, workingPath: string): string {
7486 return trimmed ;
7587}
7688
77- function formatTodoLines ( todos : TrackedTodo [ ] , limit = PLAN_TODO_LIMIT ) : string [ ] {
89+ function formatTodoLines ( todos : StatusTodo [ ] , limit = PLAN_TODO_LIMIT ) : string [ ] {
7890 const lines : string [ ] = [ ] ;
7991 for ( const todo of todos . slice ( 0 , limit ) ) {
8092 const statusLabel = todo . status === "in_progress"
@@ -165,9 +177,10 @@ export function buildToolLines(
165177}
166178
167179export function buildLiveStatusMessage (
168- request : ActiveRequest ,
180+ request : StatusRequest ,
169181 workingPath : string ,
170- state ?: SessionMessageState
182+ state ?: SessionMessageState ,
183+ frequency : MessageFrequency = "medium"
171184) : string {
172185 if ( ! state ) {
173186 if ( request . statusFrozen && request . currentText ) {
@@ -194,12 +207,12 @@ export function buildLiveStatusMessage(
194207 if ( state . todos . length > 0 ) {
195208 const todos = state . todos . map ( ( todo ) => ( {
196209 content : todo . content ,
197- status : todo . status as TrackedTodo [ "status" ] ,
210+ status : todo . status ,
198211 } ) ) ;
199212 lines . push ( "" , "*Tasks*" , ...formatTodoLines ( todos ) ) ;
200213 }
201214
202- const toolLines = buildToolLines ( state , workingPath , resolveMessageFrequency ( ) ) ;
215+ const toolLines = buildToolLines ( state , workingPath , frequency ) ;
203216 if ( toolLines . length > 0 ) {
204217 lines . push ( "" ) ;
205218 lines . push ( ...toolLines ) ;
0 commit comments