update imports for core/ restructure
ollie/pkg/X → ollie/X, execute.Registry → tools.Registry, remote.Dial → execute.RemoteDial, config.Load → agent.Load
This commit is contained in:
parent
acfc4854d4
commit
c96982c1ec
4
dbus.go
4
dbus.go
|
|
@ -13,8 +13,8 @@ import (
|
||||||
"github.com/godbus/dbus/v5"
|
"github.com/godbus/dbus/v5"
|
||||||
"github.com/godbus/dbus/v5/introspect"
|
"github.com/godbus/dbus/v5/introspect"
|
||||||
|
|
||||||
"ollie/pkg/agent"
|
"ollie/agent"
|
||||||
"ollie/pkg/backend"
|
"ollie/backend"
|
||||||
"olliesrv/session"
|
"olliesrv/session"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/godbus/dbus/v5"
|
"github.com/godbus/dbus/v5"
|
||||||
"ollie/pkg/elevate"
|
"ollie/elevate"
|
||||||
)
|
)
|
||||||
|
|
||||||
// elevateNotifier handles desktop notifications for elevation requests
|
// elevateNotifier handles desktop notifications for elevation requests
|
||||||
|
|
|
||||||
22
main.go
22
main.go
|
|
@ -14,14 +14,14 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"9fans.net/go/plan9/client"
|
"9fans.net/go/plan9/client"
|
||||||
"ollie/pkg/agent"
|
"ollie/agent"
|
||||||
"ollie/pkg/backend"
|
"ollie/backend"
|
||||||
"ollie/pkg/elevate"
|
"ollie/elevate"
|
||||||
"ollie/pkg/env"
|
"ollie/env"
|
||||||
olog "ollie/pkg/log"
|
olog "ollie/log"
|
||||||
"ollie/pkg/paths"
|
"ollie/paths"
|
||||||
"ollie/pkg/tools/execute"
|
"ollie/tools"
|
||||||
"ollie/pkg/skills"
|
"ollie/skills"
|
||||||
fs "olliesrv/fs"
|
fs "olliesrv/fs"
|
||||||
"olliesrv/mount"
|
"olliesrv/mount"
|
||||||
"olliesrv/server"
|
"olliesrv/server"
|
||||||
|
|
@ -161,7 +161,7 @@ func runServer(sockPath string) {
|
||||||
sessionsDir := paths.DataDir() + "/sessions"
|
sessionsDir := paths.DataDir() + "/sessions"
|
||||||
|
|
||||||
// Create the tool registry
|
// Create the tool registry
|
||||||
toolRegistry, regErr := execute.NewRegistry()
|
toolRegistry, regErr := tools.NewRegistry()
|
||||||
if regErr != nil {
|
if regErr != nil {
|
||||||
fmt.Fprintf(os.Stderr, "warning: tool registry: %v\n", regErr)
|
fmt.Fprintf(os.Stderr, "warning: tool registry: %v\n", regErr)
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +274,7 @@ func runServer(sockPath string) {
|
||||||
RootStore: NewRootStore(toolRegistry),
|
RootStore: NewRootStore(toolRegistry),
|
||||||
ElevateBroker: elevateBroker,
|
ElevateBroker: elevateBroker,
|
||||||
InvalidateModels: modelCache.Invalidate,
|
InvalidateModels: modelCache.Invalidate,
|
||||||
ToolPrompt: execute.ToolPrompt,
|
ToolPrompt: tools.ToolPrompt,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,7 +352,7 @@ func runServer(sockPath string) {
|
||||||
|
|
||||||
// ToolIndex generates a tool index from a tree's file listing.
|
// ToolIndex generates a tool index from a tree's file listing.
|
||||||
// NewRootStore returns a read-only FileTree for synthetic root-level files.
|
// NewRootStore returns a read-only FileTree for synthetic root-level files.
|
||||||
func NewRootStore(reg *execute.Registry) *fs.Tree {
|
func NewRootStore(reg *tools.Registry) *fs.Tree {
|
||||||
helpPath := paths.CfgDir() + "/help.md"
|
helpPath := paths.CfgDir() + "/help.md"
|
||||||
readEntries := map[string]func() ([]byte, error){
|
readEntries := map[string]func() ([]byte, error){
|
||||||
"backends": func() ([]byte, error) {
|
"backends": func() ([]byte, error) {
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/simonfxr/pubsub"
|
"github.com/simonfxr/pubsub"
|
||||||
"ollie/pkg/agent"
|
"ollie/agent"
|
||||||
"ollie/pkg/backend"
|
"ollie/backend"
|
||||||
olog "ollie/pkg/log"
|
olog "ollie/log"
|
||||||
"olliesrv/fs"
|
"olliesrv/fs"
|
||||||
"olliesrv/session"
|
"olliesrv/session"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"ollie/pkg/elevate"
|
"ollie/elevate"
|
||||||
fs "olliesrv/fs"
|
fs "olliesrv/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"ollie/pkg/backend"
|
"ollie/backend"
|
||||||
"ollie/pkg/tools/execute"
|
"ollie/tools"
|
||||||
"ollie/pkg/elevate"
|
"ollie/elevate"
|
||||||
olog "ollie/pkg/log"
|
olog "ollie/log"
|
||||||
"ollie/pkg/paths"
|
"ollie/paths"
|
||||||
"olliesrv/fs"
|
"olliesrv/fs"
|
||||||
"olliesrv/session"
|
"olliesrv/session"
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ type Server struct {
|
||||||
groups map[string]map[string]bool // group → set of members
|
groups map[string]map[string]bool // group → set of members
|
||||||
invalidateModels func()
|
invalidateModels func()
|
||||||
toolPrompt func(string) string
|
toolPrompt func(string) string
|
||||||
toolRegistry *execute.Registry
|
toolRegistry *tools.Registry
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config holds the pre-built trees and manager for the server.
|
// Config holds the pre-built trees and manager for the server.
|
||||||
|
|
@ -86,7 +86,7 @@ type Config struct {
|
||||||
InvalidateModels func()
|
InvalidateModels func()
|
||||||
ToolPrompt func(string) string
|
ToolPrompt func(string) string
|
||||||
// ToolRegistry is the shared tool registry for lazy tool promotion.
|
// ToolRegistry is the shared tool registry for lazy tool promotion.
|
||||||
ToolRegistry *execute.Registry
|
ToolRegistry *tools.Registry
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option configures the 9P server.
|
// Option configures the 9P server.
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,13 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"ollie/pkg/agent"
|
"ollie/agent"
|
||||||
"ollie/pkg/backend"
|
"ollie/backend"
|
||||||
"ollie/pkg/config"
|
olog "ollie/log"
|
||||||
olog "ollie/pkg/log"
|
"ollie/paths"
|
||||||
"ollie/pkg/paths"
|
"ollie/execute"
|
||||||
"ollie/pkg/remote"
|
"ollie/tools"
|
||||||
"ollie/pkg/tools"
|
"ollie/skills"
|
||||||
"ollie/pkg/tools/execute"
|
|
||||||
"ollie/pkg/skills"
|
|
||||||
"olliesrv/fs"
|
"olliesrv/fs"
|
||||||
"olliesrv/prompts"
|
"olliesrv/prompts"
|
||||||
)
|
)
|
||||||
|
|
@ -254,7 +252,7 @@ type ManagerConfig struct {
|
||||||
// ResetElevation resets the per-turn elevation rate limiter for a session.
|
// ResetElevation resets the per-turn elevation rate limiter for a session.
|
||||||
ResetElevation func(sessionID string)
|
ResetElevation func(sessionID string)
|
||||||
// ToolRegistry is the shared tool registry for lazy tool promotion.
|
// ToolRegistry is the shared tool registry for lazy tool promotion.
|
||||||
ToolRegistry *execute.Registry
|
ToolRegistry *tools.Registry
|
||||||
// SkillsRegistry is the shared skills registry for skill loading.
|
// SkillsRegistry is the shared skills registry for skill loading.
|
||||||
SkillsRegistry *skills.Registry
|
SkillsRegistry *skills.Registry
|
||||||
// OnSessionCreated is called after a new session is added to the manager.
|
// OnSessionCreated is called after a new session is added to the manager.
|
||||||
|
|
@ -855,7 +853,7 @@ func (s *Manager) restoreSession(ps *agent.PersistedSession) error {
|
||||||
remoteTarget := ps.Remote
|
remoteTarget := ps.Remote
|
||||||
|
|
||||||
if remoteTarget != "" {
|
if remoteTarget != "" {
|
||||||
rsrv, dialErr := remote.Dial(context.Background(), remote.Config{
|
rsrv, dialErr := execute.RemoteDial(context.Background(), execute.RemoteConfig{
|
||||||
SSHTarget: remoteTarget,
|
SSHTarget: remoteTarget,
|
||||||
CWD: cwd,
|
CWD: cwd,
|
||||||
})
|
})
|
||||||
|
|
@ -1186,7 +1184,7 @@ func (s *Manager) CreateSession(args []string) (string, error) {
|
||||||
// FIXME: Eager dial means session creation blocks on SSH connect.
|
// FIXME: Eager dial means session creation blocks on SSH connect.
|
||||||
// Eventually make this async or move host info into the prompt
|
// Eventually make this async or move host info into the prompt
|
||||||
// scripts themselves (running remotely via the RPC).
|
// scripts themselves (running remotely via the RPC).
|
||||||
rsrv, dialErr := remote.Dial(context.Background(), remote.Config{
|
rsrv, dialErr := execute.RemoteDial(context.Background(), execute.RemoteConfig{
|
||||||
SSHTarget: remoteTarget,
|
SSHTarget: remoteTarget,
|
||||||
CWD: cwd,
|
CWD: cwd,
|
||||||
})
|
})
|
||||||
|
|
@ -1345,7 +1343,7 @@ func (s *Manager) renameSession(old, new string) error {
|
||||||
|
|
||||||
// LoadAgentConfig resolves and loads the config for a named agent.
|
// LoadAgentConfig resolves and loads the config for a named agent.
|
||||||
// Returns nil if the config file does not exist; BuildRuntime handles nil configs.
|
// Returns nil if the config file does not exist; BuildRuntime handles nil configs.
|
||||||
func LoadAgentConfig(agentsDir, name string, open func(string) (*os.File, error)) *config.Config {
|
func LoadAgentConfig(agentsDir, name string, open func(string) (*os.File, error)) *agent.Config {
|
||||||
if open == nil {
|
if open == nil {
|
||||||
open = os.Open
|
open = os.Open
|
||||||
}
|
}
|
||||||
|
|
@ -1355,7 +1353,7 @@ func LoadAgentConfig(agentsDir, name string, open func(string) (*os.File, error)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
cfg, _ := config.Load(f)
|
cfg, _ := agent.Load(f)
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,10 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"ollie/pkg/agent"
|
"ollie/agent"
|
||||||
"ollie/pkg/backend"
|
"ollie/backend"
|
||||||
"ollie/pkg/tools/execute"
|
"ollie/tools"
|
||||||
olog "ollie/pkg/log"
|
olog "ollie/log"
|
||||||
"olliesrv/fs"
|
"olliesrv/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ func sessionFilePerms() map[string]os.FileMode {
|
||||||
return fs.Perms[fs.PathSessionFile].Files
|
return fs.Perms[fs.PathSessionFile].Files
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSessionTree(sess *Session, log *olog.Logger, kill func(), rename func(newID string) error, saveTranscript func([]byte) error, invalidateModels func(), resetElevation func(), toolRegistry *execute.Registry) *fs.Tree {
|
func NewSessionTree(sess *Session, log *olog.Logger, kill func(), rename func(newID string) error, saveTranscript func([]byte) error, invalidateModels func(), resetElevation func(), toolRegistry *tools.Registry) *fs.Tree {
|
||||||
h := &sessionHelper{sess: sess, log: log, kill: kill, rename: rename, saveTranscript: saveTranscript, invalidateModels: invalidateModels, resetElevation: resetElevation, toolRegistry: toolRegistry}
|
h := &sessionHelper{sess: sess, log: log, kill: kill, rename: rename, saveTranscript: saveTranscript, invalidateModels: invalidateModels, resetElevation: resetElevation, toolRegistry: toolRegistry}
|
||||||
perms := sessionFilePerms()
|
perms := sessionFilePerms()
|
||||||
specs := make([]fs.FileSpec, len(FileList))
|
specs := make([]fs.FileSpec, len(FileList))
|
||||||
|
|
@ -74,7 +74,7 @@ type sessionHelper struct {
|
||||||
saveTranscript func([]byte) error
|
saveTranscript func([]byte) error
|
||||||
invalidateModels func()
|
invalidateModels func()
|
||||||
resetElevation func() // called on prompt write to reset turn counter
|
resetElevation func() // called on prompt write to reset turn counter
|
||||||
toolRegistry *execute.Registry
|
toolRegistry *tools.Registry
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *sessionHelper) fileSpec(name string, mode os.FileMode) fs.FileSpec {
|
func (h *sessionHelper) fileSpec(name string, mode os.FileMode) fs.FileSpec {
|
||||||
|
|
|
||||||
Reference in New Issue