package agents import ( "os" "os/exec" "path/filepath" "g.fc.run/misc/byre/internal/mcp" ) const screenshotGuidance = "\n- When a turn changes something you can see, you can show it in your final message: save screenshots with the Playwright tools (pages you serve on this task's ports) or hands' capture with save (apps on this Mac), and embed each as a Markdown image, ![what it shows](), with the path the tool returned. They go to the task's media folder, outside the worktree, so they are never committed, and are deleted when the task closes. Leave out a screenshot that adds nothing to the text." func MediaDir(worktreePath string) string { return worktreePath + "-media" } func (m *Manager) handsDir(sessionID string) string { return filepath.Join(m.handsRoot, sessionID) } // replayd keys ScreenCaptureKit clients by executable path, so two hands // processes run from one path keep cancelling each other's connection. func (m *Manager) handsMCP(sessionID, mediaDir string) (mcp.Stdio, error) { src, err := exec.LookPath("byre-hands") if err != nil { return mcp.Stdio{}, err } data, err := os.ReadFile(src) if err != nil { return mcp.Stdio{}, err } dir := m.handsDir(sessionID) err = os.RemoveAll(dir) if err != nil { return mcp.Stdio{}, err } err = os.MkdirAll(dir, 0o755) if err != nil { return mcp.Stdio{}, err } bin := filepath.Join(dir, "byre-hands") err = os.WriteFile(bin, data, 0o755) if err != nil { return mcp.Stdio{}, err } return mcp.Stdio{Name: "hands", Command: bin, Args: []string{"--media-dir", mediaDir}}, nil }