@@ -97,18 +97,6 @@ func (r *Runner) Close() {
9797 r .ports .CloseDaemons ()
9898}
9999
100- type ErrContinuation struct {
101- State * State
102- }
103-
104- func (e * ErrContinuation ) Prompt () string {
105- return * e .State .Continuation .Result
106- }
107-
108- func (e * ErrContinuation ) Error () string {
109- return fmt .Sprintf ("chat continuation required: %s" , e .Prompt ())
110- }
111-
112100type ChatResponse struct {
113101 Done bool `json:"done"`
114102 Content string `json:"content"`
@@ -188,25 +176,11 @@ func (r *Runner) Chat(ctx context.Context, prevState ChatState, prg types.Progra
188176}
189177
190178func (r * Runner ) Run (ctx context.Context , prg types.Program , env []string , input string ) (output string , err error ) {
191- monitor , err := r .factory .Start (ctx , & prg , env , input )
192- if err != nil {
193- return "" , err
194- }
195- defer func () {
196- monitor .Stop (output , err )
197- }()
198-
199- callCtx := engine .NewContext (ctx , & prg )
200- state , err := r .call (callCtx , monitor , env , input )
179+ resp , err := r .Chat (ctx , nil , prg , env , input )
201180 if err != nil {
202181 return "" , err
203182 }
204- if state .Continuation != nil {
205- return "" , & ErrContinuation {
206- State : state ,
207- }
208- }
209- return * state .Result , nil
183+ return resp .Content , nil
210184}
211185
212186type Event struct {
0 commit comments