diff --git a/main_test.go b/main_test.go index fca56ed..a99f24d 100644 --- a/main_test.go +++ b/main_test.go @@ -35,7 +35,7 @@ func newNoopCore(id string) *session.Session { NewBackend: func(name string) (backend.Backend, error) { return backend.NewNoop(name, "default"), nil }, - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }) } @@ -59,7 +59,7 @@ func newBlockingCore(id string) *session.Session { NewBackend: func(name string) (backend.Backend, error) { return backend.NewNoop(name, "default"), nil }, - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }) } @@ -81,7 +81,7 @@ func newContentCore(id, content string) *session.Session { NewBackend: func(name string) (backend.Backend, error) { return backend.NewNoop(name, "default"), nil }, - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }) } @@ -128,7 +128,7 @@ func newTestSessionManagerWithCore(t *testing.T) *mgr.Manager { NewBackend: func(name string) (backend.Backend, error) { return backend.NewNoop(name, "default"), nil }, - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }), nil }, }) @@ -864,7 +864,7 @@ func TestSessionFileStoreMakePublishMultipleEvents(t *testing.T) { AgentName: "default", CWD: "/tmp", SessionID: "s1", - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }) ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -1160,7 +1160,7 @@ func TestSessionManagerCreateSessionEnvExpansion(t *testing.T) { AgentName: agentName, CWD: cwd, SessionID: sessionID, - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }), nil }, }) @@ -1185,7 +1185,7 @@ func TestSessionManagerCreateSessionTildeExpansion(t *testing.T) { AgentName: agentName, CWD: cwd, SessionID: sessionID, - NewToolServer: func() tools.Server { return nil }, + NewToolServer: func() tools.Runner { return nil }, }), nil }, }) diff --git a/mgr/create.go b/mgr/create.go index e12aea8..ade2efa 100644 --- a/mgr/create.go +++ b/mgr/create.go @@ -6,9 +6,8 @@ import ( "context" "fmt" "ollie/backend" - "ollie/execute" - "ollie/paths" "ollie/tools" + "ollie/paths" "olliesrv/fs" "olliesrv/prompts" "os" @@ -111,47 +110,47 @@ func (s *Manager) CreateSession(args []string) (string, error) { return "", fmt.Errorf("sessions dir: %w", err) } - var execOpts []execute.Option + var execOpts []tools.Option if !s.cfg.NoMount { } if s.cfg.Strict { - execOpts = append(execOpts, execute.WithStrict()) + execOpts = append(execOpts, tools.WithStrict()) } if s.cfg.Yolo { - execOpts = append(execOpts, execute.WithYolo()) + execOpts = append(execOpts, tools.WithYolo()) } if cfg != nil && len(cfg.AllowTools) > 0 { - execOpts = append(execOpts, execute.WithAllowTools(cfg.AllowTools)) + execOpts = append(execOpts, tools.WithAllowTools(cfg.AllowTools)) } if s.cfg.ToolRegistry != nil { - execOpts = append(execOpts, execute.WithToolRegistry(s.cfg.ToolRegistry, sessID)) + execOpts = append(execOpts, tools.WithToolRegistry(s.cfg.ToolRegistry, sessID)) } if s.cfg.SkillsRegistry != nil { - execOpts = append(execOpts, execute.WithSkillsRegistry(s.cfg.SkillsRegistry)) + execOpts = append(execOpts, tools.WithSkillsRegistry(s.cfg.SkillsRegistry)) } - var newToolServer func() tools.Server + var newToolServer func() tools.Runner var remoteEnv []string // extra env vars from remote host info if remoteTarget != "" { // Dial eagerly so we get HostInfo for prompt resolution. // FIXME: Eager dial means session creation blocks on SSH connect. // Eventually make this async or move host info into the prompt // scripts themselves (running remotely via the RPC). - rsrv, dialErr := execute.RemoteDial(s.cfg.Ctx, execute.RemoteConfig{ + rsrv, dialErr := tools.RemoteDial(s.cfg.Ctx, tools.RemoteConfig{ SSHTarget: remoteTarget, CWD: cwd, }) if dialErr != nil { return "", fmt.Errorf("remote dial: %w", dialErr) } - newToolServer = func() tools.Server { return rsrv } + newToolServer = func() tools.Runner { return rsrv } remoteEnv = []string{ "PRIME_CWD=" + cwd, "PRIME_PLATFORM=" + rsrv.Info.Platform, "PRIME_IS_GIT_REPO=" + fmt.Sprintf("%v", rsrv.Info.IsGitRepo), } } else { - newToolServer = execute.Decl(cwd, execOpts...) + newToolServer = tools.Decl(cwd, execOpts...) } var promptEnv []string @@ -229,7 +228,7 @@ func (s *Manager) CreateSession(args []string) (string, error) { sessPtr = sess sess.remote = remoteTarget - // For remote sessions, the mount isn't managed by a local execute.Server + // For remote sessions, the mount isn't managed by a local tools.Server // (which doesn't exist). Start it directly so $OLLIE is available for s.mu.Lock() sess.uname = uname diff --git a/mgr/persist.go b/mgr/persist.go index ee47752..1be528f 100644 --- a/mgr/persist.go +++ b/mgr/persist.go @@ -6,7 +6,6 @@ import ( "context" "fmt" "ollie/backend" - "ollie/execute" "ollie/tools" "olliesrv/prompts" "os" @@ -132,41 +131,41 @@ func (s *Manager) restoreSession(ps *agent.PersistedAgent) error { } uname := s.nextUname() - var newToolServer func() tools.Server + var newToolServer func() tools.Runner var promptEnv []string remoteTarget := ps.Remote if remoteTarget != "" { - rsrv, dialErr := execute.RemoteDial(s.cfg.Ctx, execute.RemoteConfig{ + rsrv, dialErr := tools.RemoteDial(s.cfg.Ctx, tools.RemoteConfig{ SSHTarget: remoteTarget, CWD: cwd, }) if dialErr != nil { return fmt.Errorf("remote dial: %w", dialErr) } - newToolServer = func() tools.Server { return rsrv } + newToolServer = func() tools.Runner { return rsrv } promptEnv = []string{ "PRIME_CWD=" + cwd, "PRIME_PLATFORM=" + rsrv.Info.Platform, "PRIME_IS_GIT_REPO=" + fmt.Sprintf("%v", rsrv.Info.IsGitRepo), } } else { - var execOpts []execute.Option + var execOpts []tools.Option if !s.cfg.NoMount { } if s.cfg.Strict { - execOpts = append(execOpts, execute.WithStrict()) + execOpts = append(execOpts, tools.WithStrict()) } if s.cfg.Yolo { - execOpts = append(execOpts, execute.WithYolo()) + execOpts = append(execOpts, tools.WithYolo()) } if s.cfg.ToolRegistry != nil { - execOpts = append(execOpts, execute.WithToolRegistry(s.cfg.ToolRegistry, sessID)) + execOpts = append(execOpts, tools.WithToolRegistry(s.cfg.ToolRegistry, sessID)) } if s.cfg.SkillsRegistry != nil { - execOpts = append(execOpts, execute.WithSkillsRegistry(s.cfg.SkillsRegistry)) + execOpts = append(execOpts, tools.WithSkillsRegistry(s.cfg.SkillsRegistry)) } - newToolServer = execute.Decl(cwd, execOpts...) + newToolServer = tools.Decl(cwd, execOpts...) promptEnv = agent.PromptEnv(cwd) }