@@ -97,18 +97,6 @@ func (r *Runner) Close() {
97
97
r .ports .CloseDaemons ()
98
98
}
99
99
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
-
112
100
type ChatResponse struct {
113
101
Done bool `json:"done"`
114
102
Content string `json:"content"`
@@ -188,25 +176,11 @@ func (r *Runner) Chat(ctx context.Context, prevState ChatState, prg types.Progra
188
176
}
189
177
190
178
func (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 )
201
180
if err != nil {
202
181
return "" , err
203
182
}
204
- if state .Continuation != nil {
205
- return "" , & ErrContinuation {
206
- State : state ,
207
- }
208
- }
209
- return * state .Result , nil
183
+ return resp .Content , nil
210
184
}
211
185
212
186
type Event struct {
0 commit comments