Update messaging skill and execute command
This commit is contained in:
parent
1f42297107
commit
17ec56fbdd
|
|
@ -168,16 +168,33 @@ func executeCode(code, language string, timeout int) (string, error) {
|
|||
case "bash", "":
|
||||
args := []string{
|
||||
"--rwx", workDir,
|
||||
"--rox", "/usr",
|
||||
"--rox", "/lib",
|
||||
"--rox", "/lib64",
|
||||
"--rox", "/bin",
|
||||
"--ro", "/etc/alternatives",
|
||||
"--ro", "/etc/ld.so.cache",
|
||||
"--rw", namespace,
|
||||
"--unrestricted-network",
|
||||
}
|
||||
|
||||
// Add common system paths if they exist
|
||||
systemPaths := []struct {
|
||||
flag string
|
||||
path string
|
||||
}{
|
||||
{"--rox", "/usr"},
|
||||
{"--rox", "/lib"},
|
||||
{"--rox", "/lib64"},
|
||||
{"--rox", "/bin"},
|
||||
{"--ro", "/etc/alternatives"},
|
||||
{"--ro", "/etc/ld.so.cache"},
|
||||
}
|
||||
|
||||
for _, sp := range systemPaths {
|
||||
if _, err := os.Stat(sp.path); err == nil {
|
||||
args = append(args, sp.flag, sp.path)
|
||||
}
|
||||
}
|
||||
|
||||
// Add namespace if set
|
||||
if namespace != "" {
|
||||
args = append(args, "--rw", namespace)
|
||||
}
|
||||
|
||||
// Add common user binary directories
|
||||
userBinDirs := []string{
|
||||
filepath.Join(homeDir, "bin"),
|
||||
|
|
@ -198,12 +215,13 @@ func executeCode(code, language string, timeout int) (string, error) {
|
|||
}
|
||||
|
||||
args = append(args,
|
||||
"--env", "NAMESPACE=" + namespace,
|
||||
"--env", "PATH=/usr/bin:/bin",
|
||||
"--env", "HOME=" + homeDir,
|
||||
"--env", "NAMESPACE",
|
||||
"--env", "PATH",
|
||||
"--env", "HOME",
|
||||
"--env", "PLAN9",
|
||||
)
|
||||
if agentID != "" {
|
||||
args = append(args, "--env", "AGENT_ID="+agentID)
|
||||
args = append(args, "--env", "AGENT_ID")
|
||||
}
|
||||
args = append(args, "--", "bash", "-c", code)
|
||||
|
||||
|
|
@ -252,7 +270,7 @@ func executeCode(code, language string, timeout int) (string, error) {
|
|||
if err != nil {
|
||||
execLog.Error = err.Error()
|
||||
logExecution(execLog)
|
||||
return string(output), fmt.Errorf("execution failed: %v", err)
|
||||
return string(output), fmt.Errorf("execution failed: %v\nOutput: %s", err, string(output))
|
||||
}
|
||||
|
||||
logExecution(execLog)
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ when_to_load: Load when you need to send messages to other agents, respond to th
|
|||
|
||||
## Commands
|
||||
|
||||
- List agents: `bash <(9p read agent/tools/agents/list_sessions.sh)`
|
||||
- Send message: `bash <(9p read agent/tools/messaging/send_message.sh) FROM TO TYPE SUBJECT BODY`
|
||||
- Check inbox: `bash <(9p read agent/tools/messaging/read_inbox.sh) AGENT_ID`
|
||||
Use `execute_code` tool with these commands:
|
||||
|
||||
- List agents: `9p read agent/tools/agents/list_sessions.sh | bash`
|
||||
- Send message: `9p read agent/tools/messaging/send_message.sh | bash -s FROM TO TYPE SUBJECT BODY`
|
||||
- Check inbox: `9p read agent/tools/messaging/read_inbox.sh | bash -s AGENT_ID`
|
||||
|
||||
## Use Cases
|
||||
|
||||
|
|
|
|||
Reference in New Issue