Add PICOCLAW_AGENT_WORKSPACE env var
- Pass workingDir to WithPicoclawEnvVars - Add PICOCLAW_AGENT_WORKSPACE for child processes to know their workspace
This commit is contained in:
parent
347aade2fb
commit
64fc4a82d0
2 changed files with 7 additions and 2 deletions
|
|
@ -149,7 +149,7 @@ func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Conf
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure PICOCLAW_* vars are set for child processes
|
// Ensure PICOCLAW_* vars are set for child processes
|
||||||
envSet = shell.WithPicoclawEnvVars(envSet)
|
envSet = shell.WithPicoclawEnvVars(envSet, workingDir)
|
||||||
|
|
||||||
return &ExecTool{
|
return &ExecTool{
|
||||||
workingDir: workingDir,
|
workingDir: workingDir,
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ func isAllowedPrefix(name string) bool {
|
||||||
|
|
||||||
// WithPicoclawEnvVars ensures PICOCLAW_* vars are set in envSet.
|
// WithPicoclawEnvVars ensures PICOCLAW_* vars are set in envSet.
|
||||||
// These are needed for child processes to locate config, workspace, etc.
|
// These are needed for child processes to locate config, workspace, etc.
|
||||||
func WithPicoclawEnvVars(envSet map[string]string) map[string]string {
|
func WithPicoclawEnvVars(envSet map[string]string, workspace string) map[string]string {
|
||||||
if envSet == nil {
|
if envSet == nil {
|
||||||
envSet = make(map[string]string)
|
envSet = make(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
@ -174,6 +174,11 @@ func WithPicoclawEnvVars(envSet map[string]string) map[string]string {
|
||||||
envSet["PICOCLAW_CONFIG"] = filepath.Join(home, "config.json")
|
envSet["PICOCLAW_CONFIG"] = filepath.Join(home, "config.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Workspace - this is the agent's working directory
|
||||||
|
if workspace != "" {
|
||||||
|
envSet["PICOCLAW_AGENT_WORKSPACE"] = workspace
|
||||||
|
}
|
||||||
|
|
||||||
if exe, err := os.Executable(); err == nil {
|
if exe, err := os.Executable(); err == nil {
|
||||||
envSet["PICOCLAW_EXE"] = exe
|
envSet["PICOCLAW_EXE"] = exe
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue