@@ -26,7 +26,7 @@ type MonitorFactory interface {
2626type Monitor interface {
2727 Event (event Event )
2828 Pause () func ()
29- Stop (output string , err error )
29+ Stop (ctx context. Context , output string , err error )
3030}
3131
3232type Options struct {
@@ -162,7 +162,7 @@ func (r *Runner) Chat(ctx context.Context, prevState ChatState, prg types.Progra
162162 return resp , err
163163 }
164164 defer func () {
165- monitor .Stop (resp .Content , err )
165+ monitor .Stop (ctx , resp .Content , err )
166166 }()
167167
168168 callCtx , err := engine .NewContext (ctx , & prg , input )
@@ -425,9 +425,7 @@ func (r *Runner) start(callCtx engine.Context, state *State, monitor Monitor, en
425425 }
426426 }
427427
428- var (
429- newState * State
430- )
428+ var newState * State
431429 callCtx .InputContext , newState , err = r .getContext (callCtx , state , monitor , env , input )
432430 if err != nil {
433431 return nil , err
@@ -632,9 +630,7 @@ func (r *Runner) resume(callCtx engine.Context, monitor Monitor, env []string, s
632630 Env : env ,
633631 }
634632
635- var (
636- contentInput string
637- )
633+ var contentInput string
638634
639635 if state .Continuation != nil && state .Continuation .State != nil {
640636 contentInput = state .Continuation .State .Input
@@ -745,9 +741,7 @@ func (r *Runner) newDispatcher(ctx context.Context) dispatcher {
745741}
746742
747743func (r * Runner ) subCalls (callCtx engine.Context , monitor Monitor , env []string , state * State , toolCategory engine.ToolCategory ) (_ * State , callResults []SubCallResult , _ error ) {
748- var (
749- resultLock sync.Mutex
750- )
744+ var resultLock sync.Mutex
751745
752746 if state .Continuation != nil {
753747 callCtx .LastReturn = state .Continuation
0 commit comments