Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/root/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (f *runExecFlags) runOrExec(ctx context.Context, out *cli.Printer, args []s

var source teamloader.AgentSource
if agentFileName == "default" {
source = teamloader.NewBytesSource(f.runConfig.WorkingDir, defaultAgent)
source = teamloader.NewBytesSource(defaultAgent)
} else {
source = teamloader.NewFileSource(agentFileName)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/creator/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Can you explain to me what the agent will be used for?`,

return teamloader.LoadFrom(
ctx,
teamloader.NewBytesSource(runConfig.WorkingDir, configAsJSON),
teamloader.NewBytesSource(configAsJSON),
runConfig,
teamloader.WithModelOverrides([]string{modelNameOverride}),
teamloader.WithToolsetRegistry(registry),
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ func (s *Server) loadTeamForSession(ctx context.Context, agentFilename string, s

reloaded, err := teamloader.LoadFrom(
ctx,
teamloader.NewBytesSource(sess.WorkingDir, []byte(yamlContent)),
teamloader.NewBytesSource([]byte(yamlContent)),
rc,
teamloader.WithID(agentFilename),
)
Expand Down
14 changes: 4 additions & 10 deletions pkg/teamloader/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,12 @@ func (a fileSource) Read() ([]byte, error) {

// bytesSource is used to load an agent configuration from a []byte.
type bytesSource struct {
workingDir string
data []byte
data []byte
}

func NewBytesSource(workingDir string, data []byte) AgentSource {
// TODO(dga): this is not perfect but ok for now
if workingDir == "" {
workingDir = "."
}
func NewBytesSource(data []byte) AgentSource {
return bytesSource{
workingDir: workingDir,
data: data,
data: data,
}
}

Expand All @@ -69,7 +63,7 @@ func (a bytesSource) Name() string {
}

func (a bytesSource) ParentDir() string {
return a.workingDir
return ""
}

func (a bytesSource) Read() ([]byte, error) {
Expand Down
5 changes: 4 additions & 1 deletion pkg/teamloader/teamloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ func LoadFrom(ctx context.Context, source AgentSource, runtimeConfig *config.Run
}

fileName := source.Name()
parentDir := source.ParentDir()
env := runtimeConfig.EnvProvider()
parentDir := source.ParentDir()
if parentDir == "" {
parentDir = runtimeConfig.WorkingDir
}

// Load the agent's configuration
data, err := source.Read()
Expand Down
Loading