@@ -41,7 +41,7 @@ type Server struct {
4141 srv * http.Server
4242 mu sync.RWMutex
4343 logger * slog.Logger
44- conversation * st.Conversation
44+ conversation * st.PTYConversation
4545 agentio * termexec.Process
4646 agentType mf.AgentType
4747 emitter * EventEmitter
@@ -244,7 +244,7 @@ func NewServer(ctx context.Context, config ServerConfig) (*Server, error) {
244244 return mf .FormatToolCall (config .AgentType , message )
245245 }
246246
247- conversation := st .NewConversation (ctx , st.ConversationConfig {
247+ conversation := st .NewPTY (ctx , st.PTYConversationConfig {
248248 AgentType : config .AgentType ,
249249 AgentIO : config .Process ,
250250 Clock : config .Clock ,
@@ -337,7 +337,7 @@ func sseMiddleware(ctx huma.Context, next func(huma.Context)) {
337337}
338338
339339func (s * Server ) StartSnapshotLoop (ctx context.Context ) {
340- s .conversation .StartSnapshotLoop (ctx )
340+ s .conversation .Start (ctx )
341341 go func () {
342342 ticker := s .clock .NewTicker (snapshotInterval )
343343 defer ticker .Stop ()
@@ -346,7 +346,7 @@ func (s *Server) StartSnapshotLoop(ctx context.Context) {
346346
347347 // Send initial prompt when agent becomes stable for the first time
348348 if ! s .conversation .InitialPromptSent && convertStatus (currentStatus ) == AgentStatusStable {
349- if err := s .conversation .SendMessage (FormatMessage (s .agentType , s .conversation .InitialPrompt )... ); err != nil {
349+ if err := s .conversation .Send (FormatMessage (s .agentType , s .conversation .InitialPrompt )... ); err != nil {
350350 s .logger .Error ("Failed to send initial prompt" , "error" , err )
351351 } else {
352352 s .conversation .InitialPromptSent = true
@@ -357,7 +357,7 @@ func (s *Server) StartSnapshotLoop(ctx context.Context) {
357357 }
358358 s .emitter .UpdateStatusAndEmitChanges (currentStatus , s .agentType )
359359 s .emitter .UpdateMessagesAndEmitChanges (s .conversation .Messages ())
360- s .emitter .UpdateScreenAndEmitChanges (s .conversation .Screen ())
360+ s .emitter .UpdateScreenAndEmitChanges (s .conversation .Text ())
361361
362362 select {
363363 case <- ctx .Done ():
@@ -461,7 +461,7 @@ func (s *Server) createMessage(ctx context.Context, input *MessageRequest) (*Mes
461461
462462 switch input .Body .Type {
463463 case MessageTypeUser :
464- if err := s .conversation .SendMessage (FormatMessage (s .agentType , input .Body .Content )... ); err != nil {
464+ if err := s .conversation .Send (FormatMessage (s .agentType , input .Body .Content )... ); err != nil {
465465 return nil , xerrors .Errorf ("failed to send message: %w" , err )
466466 }
467467 case MessageTypeRaw :
0 commit comments